Yata
(Yata)
December 30, 2015, 7:32am
1
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.
Daekesh
(Daekesh)
December 30, 2015, 12:12pm
2
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;
devlyn811
(devlyn811)
December 30, 2015, 3:10pm
3
Real quick - you want
TEnumAsByte<EUserDefinedEnum> MyEnum;
or it won’t compile.
devlyn811
(devlyn811)
December 30, 2015, 3:13pm
4
Sorry TTam - you’re right, I didn’t notice the ‘class’ and uint8 - my bad.
Daekesh
(Daekesh)
December 30, 2015, 3:58pm
5
You’d also have had to have the enum in a namespace if it were the old style.