Enum to String in Unreal Engine: How I Learned to Stop Hardcoding and Love Type Safety

biq
3 min readOct 19, 2020
Just imagine she is searching for the right strings.

Intro

There are things, that come up time and time again. One of those things is creating a string version of Enum values in Unreal Engine. For this and other cases, we started to condense some of our utility and helper functions into a module. This module can then be used as part of a plugin, or as a standalone game module. In this article, I want to highlight our approach for to stringify enum values.

Setup

API Example

Imagine we want to log the value of an enum type called EWlanNotificationMSM. The API would look like this.

Let’s make this happen.

Type safety

One of the goals I had in mind, when designing BIQStringify was the ability to work with a type safe call signature. Unreal Engine already provides a handy function for retrieving type information, called FindObject.

--

--