@axelkomair01 UEnum::GetValueAsString()
works in shipped build, UEnum::GetDisplayValueAsText()
does not.
I just came across this thread today after finding out the hard way.
I’ve been using an enum with UMETA tag to represent mesh bone names which worked well in editor.
UENUM(BlueprintType)
enum class EBoneName : uint8
{
None UMETA(DisplayName = "none"),
Pelvis UMETA(DisplayName = "pelvis"),
RightHandSocket UMETA(DisplayName = "hand_r_socket"),
etc.
};
UMETA() will not be in a packaged build so the display name will return null.
I had to switch things around and use a different approach to get the names. The enums are now the bone/socket names with a function call to get the actual string. The string needs to be split since the output will be something like “EBoneName::hand_r_socket”, then convert to FName since that is commonly used for referencing bones etc.
UENUM(BlueprintType)
enum class EBoneName : uint8
{
None UMETA(DisplayName = "None"),
pelvis UMETA(DisplayName = "pelvis"),
hand_r_socket UMETA(DisplayName = "hand_r_socket")
etc.
};
const FString EnumString = UEnum::GetValueAsString(Enum);
FString LeftString;
FString RightString;
EnumString.Split(TEXT("::"), &LeftString, &RightString);
return FName(*RightString);