If a user makes an enumerator in C++ and sets one of the variables to Hidden and doesn't make it the last variable of the enum, it will cause issues with the numbering of the enum when using the Select node in blueprints.
1. Create a new project
2. Create a new C++ class of the type Actor
3. Add the following code to the .h file for the new class on line 7
UENUM(BlueprintType) enum class TestEnum { One UMETA(DisplayName=ThisIsTheSecond), Two UMETA(DisplayName=ThisIsTheThird), Invalid UMETA(Hidden) };
4. Compile and save
5. Make a new blueprint based off your new C++ class
6. Add 2 string variables and a variable of the enum you created (TestEnum), set the default values to "Hello", "Goodbye" and "ThisIsTheSecond" respectively.
7. Make a 'get' of the first string and drag off it to make a Select node
8. Connect a Get TestEnum node to the Index pin of the new Select node
9. Connect a get for both of the strings you created to the pins "ThisIsTheSecond" and "ThisIsTheThird" in order
10. Pull off the Return Value pin and make a Print string and connect BeginPlay's execute pin to the Print String.
11. Compile and save
12. Add a new instance of your new blueprint to the level
13. Start PIE
14. Notice that even though the print string should print Hello, it prints Goodbye, as if the enum is referring to "ThisIsTheThird"
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.7.6 |
Target Fix | 4.9 |
Fix Commit | 2576970 |
---|
Created | May 26, 2015 |
---|---|
Resolved | Jun 23, 2015 |
Updated | Apr 27, 2018 |