Enums are commonly used in C++ as flags or inputs to switch statements. However, what if you want to pass an enum value to or from C++ from a Blueprint? Alternatively, if you want to use a switch statement in Blueprint that uses an enum from C++, how do you let the Blueprint editor know that your enum should be accessible within the editor? This recipe shows you how to make enums visible in Blueprint.
Creating C++ enums that can be used in Blueprint
How to do it...
- Create a new StaticMeshActor class called Tree using the editor.
- Insert the following code above the class declaration:
#pragma once
#include "CoreMinimal.h"
#include "Engine/StaticMeshActor.h"
#include "Tree.generated.h"
UENUM(BlueprintType...