Enum selection field in component

How can I add selection of a Enum type in my SceneComponent. I’ve added

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Classes)
TSubclassOf<class UUserDefinedEnum> EnumClass;

But the only thing I can select then in Editor is UUserDefinedEnum and no my enums defined in Content Browser show up there.

You can’t define something like that using a content-browser created enum from within c++. You need to create the enum in c++ or use a blueprint-based property.

For reference, this is how you do it in c++:

UENUM( BlueprintType )
enum class EUserDefinedENum : uint8
{
  U_SomeValue,
  U_SomeOtherValue
};

UPROPERTY( EditAnywhere, BlueprintReadOnly, Category = Classes )
EUserDefinedEnum MyEnum;

Real quick - you want

TEnumAsByte<EUserDefinedEnum> MyEnum;

or it won’t compile.

Sorry TTam - you’re right, I didn’t notice the ‘class’ and uint8 - my bad.

You’d also have had to have the enum in a namespace if it were the old style. :slight_smile: