How to replace BP enums and structs with c++?

Finally found a way to do it! Only for enums, but still :wink: Writing here instead of a new answer so that you guys all get a notification. After creating the new enum in code and before launching the editor you must add an entry to the defaultengine.ini config in the [CoreRedirects] section. Goes like this:

+EnumRedirects=(OldName="OLD_ENUM_NAME_HERE",NewName="/Script/PROJECT_NAME_HERE.NEW_ENUM_NAME_HERE",OverrideClassName="/Script/CoreUObject.Enum",ValueChanges=(("NewEnumerator0","NEW_ENUM_VALUE_0"),("NewEnumerator1","NEW_ENUM_VALUE_1"),("NewEnumerator2","NEW_ENUM_VALUE_2")))

Of course, if you have more enum values you just keep adding the redirects between values. Now a little explanation:

OverrideClassName="/Script/CoreUObject.Enum" - this is what you use for a BP created enum. Every enum created in content instead of code has this class.

NewEnumerator0, NewEnumerator1 etc. - every content created enum has values in this fashion. I know you can change the name of each entry, but you are changing the display name, not the actual enum entries.

Verified in 4.23. Yeah I know, took a while, my first answer here is from mid 2016 :wink: Actually wasn’t me who found it, just a fellow programmer on the team who had to replace several BP enums used all over the prototype project. He declined going with manual replace :wink:

1 Like