Download

Blueprint Enumerators

Hello,
Is there a way to create an Enumerator in Blueprints? for example, i’d like to build a state machine, and right now i’m just using ‘name’ type variables to get/set the state, but as an alternative to this, i was interested in creating a custom type, and then checking for that type in some sort of drop down menu within a blueprint function so i could verify consistency between classes when i cast. or maybe there is a better way to handle this in blueprints?

Easy as pie!
Right-click in the My Blueprint/Variables area and select Create Enum Asset. This will actually create an Enum .uasset in the same folder as the Blueprint it was created in. This Enum can be shared between blueprints as well! Then, use the Switch on Enum macro and you’re off to the races!
http://i.imgur.com/t0wTDdF.png?1

wow. that was exactly what i was looking for. thanks Tom! btw, i followed some of your work over at PB awhile ago. pretty cool and inspiring.

Hey, thanks! Now I feel famous! :smiley:

Are these Enums global across all the BPs? Meaning if my level or game mode or some other BP sets the Enum, then can my HUD BP listen for the change or do I need to pass that information through with an interface event etc?

you might want to use an event dispatcher for that.

the custom enum is available between classes. however i think you actually want access to whatever variable is holding the ‘current enum type’.

set the current type, and tell the world it’s been set

6885411fb973972ec98ee6da65e186a89341c51f.jpeg

bind the dispatch event to the hud and do stuff when it’s triggered

8a16fdd4db419ff136721ea4e20799abf86a1696.jpeg

^
What he said…

Um, does this Create Enum Asset thing still exist? I don’t see it when I right-click there.

EDIT:

I found it. They moved the option:

https://answers.unrealengine.com/questions/11185/request-enum-variable.html

One answer shows that it’s moved to Content -> Add New

Content -> Add New -> Blueprints -> Enumeration to be precise.