There is an engine bug when using the EnumRedirects feature inside a config file. If we have a Blueprint Enum used in our blueprints, and we want to convert all the Blueprint enum references to a C+ enum, not all scenarios update correctly.
With the +EnumRedirects feature inside a config file, two issues have been found:
1- The first issue is related to the deserializing process. Some variables do not deserialize correctly. If the enum is used as the Key type of a Map, the Key type is changed correctly, but not the value. The user did this test on a DataAsset. It looks like the issue is related to the FCoreRedirects::GetMatchingRedirects, not setting the internal OldName variable to the expected name.
2- The second issue seems to come with Wildcard nodes. If we create a map blueprint variable that uses the Blueprint Enum as the Key type, when we redirect the enum to the C++ one, all the Find/Add map wildcard nodes will still have referenced the old Blueprint enum and not the cpp one. It does not update/refresh the values correctly. This issue is directly related to the creation of wildcards nodes.
1- Create a Blueprint Enum asset. Add two entries: A,B.
2- Create a Blueprint that inherits from PrimaryDataAsset (a Blueprint, not a DataAsset). After this, create a DataAsset from the blueprint.
3- Inside the Blueprint, create two variables. The first variable of the Enum type, and also a Map variable with the enum as the key type and the value as an integer. Map<MyEnum, int>.
4- Add the +EnumRedirects inside DefaultEngine.ini. Example:
+EnumRedirects=(OldName="BPEnum", NewName="/Script/Something.ENativeEnum", OverrideClassName="/Script/CoreUObject.Enum", ValueChanges=(("NewEnumerator0", "A"),("NewEnumerator1", "B"))
5- Relaunch the editor
6- Open the DataAsset blueprint, the Find node will show NewEnumeratorX (the blueprint enum, not the C++). If you open the options box, you can see the values showed correctly,
7- Save the Blueprint and Reload the DataAsset. This will serialize the enums. Open the asset and see that the enum property has been reset (shows A instead of B), and the map override is indeed correct.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-222232 in the post.
0 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 5.3 |
Target Fix | 5.6 |
Created | Aug 20, 2024 |
---|---|
Updated | Aug 23, 2024 |