UE5 Converting Enums to FString in C++

Table of Contents

Works in Unreal Engine 5. Tested on UE 5.8. Updated October 2026.

Quick answer: for any enum declared with UENUM(), one line gives you its name as a string:

FString Name = UEnum::GetValueAsString(MyEnumValue);           // "EWeaponFireMode::SemiAuto"
FText DisplayName = UEnum::GetDisplayValueAsText(MyEnumValue);  // "Semi-Auto"

No switch statements needed. Use GetValueAsString for logs and saving, and GetDisplayValueAsText for the friendly name set with DisplayName.

The example enum

The enum must have UENUM() above it, otherwise Unreal knows nothing about its names.

				
					UENUM(BlueprintType)
enum class EWeaponFireMode : uint8
{
	SemiAuto UMETA(DisplayName = "Semi-Auto"),
	Burst    UMETA(DisplayName = "3-Round Burst"),
	FullAuto
};
				
			

Get the name without “EWeaponFireMode::”

For an enum class, GetValueAsString includes the enum’s name. If you only want SemiAuto:

				
					FString ShortName = StaticEnum<EWeaponFireMode>()->GetNameStringByValue(static_cast<int64>(FireMode));  // "SemiAuto"
				
			

Showing the name to players

GetDisplayValueAsText returns the DisplayName you wrote (“3-Round Burst”) in the editor. In a packaged game the DisplayName is not included, so it falls back to the plain name (“Burst”). For text players see in a shipped game, return your own FText for each value (for example with a switch and LOCTEXT).

Convert a string back to an enum

				
					int64 Value = StaticEnum<EWeaponFireMode>()->GetValueByNameString(TEXT("FullAuto"));

if (Value != INDEX_NONE)
{
	EWeaponFireMode FireMode = static_cast<EWeaponFireMode>(Value);
}
				
			

INDEX_NONE means no value has that name. Both “FullAuto” and “EWeaponFireMode::FullAuto” work.

Enum to string in Blueprints

Drag the enum pin onto any String input (for example Print String). Unreal adds an Enum to String conversion node for you. Drag it onto a Name input instead and you get Enum to Name.

Print an enum with UE_LOG

				
					UE_LOG(LogTemp, Log, TEXT("Fire mode: %s"), *UEnum::GetValueAsString(FireMode));
				
			

Remember the * before UEnum::GetValueAsString: %s needs a character pointer, not an FString.

FAQ

Why does GetValueAsString return “EWeaponFireMode::SemiAuto”?

That is how Unreal stores names for enum class values. Use GetNameStringByValue (above) for the short name.

My enum isn’t a UENUM. Can I still convert it?

Not with these functions. Add UENUM() to the enum, or write a small switch that returns the name for each value.

Does GetDisplayValueAsText work in a packaged game?

It runs, but returns the plain name instead of the DisplayName. Use your own text for player-facing labels.

Can I use an enum as a TMap key?

Yes. TMap<EWeaponFireMode, int32> works without any extra code.

Related tutorials