Switch on enum not showing up in BP.

I’ve written a custom class that inherits from Actor.h and adds an enum “ETileStateEnum”:

UENUM(BlueprintType)
enum class ETileStateEnum : uint8
{
	TSE_Blank	UMETA(DisplayName = "Blank"),
	TSE_Wood	UMETA(DisplayName = "Wood")
};

UCLASS()
class MYPROJECT_API AGameTile : public AActor
{
	GENERATED_BODY()
	
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Enum)
	ETileStateEnum TileStateEnum;
};

I then created a Blueprint based on this class.

This allows me to use the enum class I defined in my blueprint for the most part, however when I attempt to add a switch for this enum I can’t find the “Switch On ETileStateEnum” option anywhere.

Any ideas on why this isn’t showing up?

Hi ,

Try to compile code (Development Editor) from visual studio and then load editor.

Hope it helps!

I can confirm that your code is working as long as you compile it :wink:

I copy-pasted this :

 UENUM(BlueprintType)
enum class ETileStateEnum : uint8
{
TSE_Blank UMETA(DisplayName = "Blank"),
TSE_Wood UMETA(DisplayName = "Wood")
};

in one of my game .h and re-compiled my game. The Switch On ETileStateEnum node appears correctly after that.

Depending on your engine version, there was also some weird issue with the Context Sensitive menu before, so if that’s not your problem, you can try unchecking that box and see if there any difference.

I had compiled the code before posting, without compiling the blueprints would not have displayed the enum type as being a valid type, after closing the project, restarting my computer, updating to 4.7.3 and reopening the projected I can now see the Switch On option for the enum.

My problem is solved for now but I’m imagine it might mean I have to close the editor and reopen it every time I want to get a new type in, I’m going to try a couple things to see if I can reproduce the problem and see what is the smallest thing I can do to fix it to speed up development.

There is a lot of stuff that the hot reload will not correctly reload. Like adding new UPROPERTY, etc. If you did not close your editor I would assume this was your problem :slight_smile: