I have a UEnum declared in the usual way. It’s part of a struct, as the first member.
I’m trying to make a TArray of these structs and the compiler just doesn’t recognise them as enums and gives me a massive stack of errors like “no instance of constructor” and “undeclared identifier”. I’ve fallen back on doing this function in Blueprint but I want to know why it doesn’t work, if anyone can help me?
The TArray is initialised like so:
TArray<FMyStruct> ArrayofMyStruct =
{
{ EMyEnumType1, 0, 1 },
{ EMyEnumType2, 0, 1 },
{ EMyEnumType3, 0, 1 }
};
Intellisense just tells me the UEnums are undefined. I’m not sure what I’ve done wrong. The header file with the struct and enums definitions are included. The other values are int32.
UENUM(BlueprintType)
enum class EMyEnumType : uint8
{
EMyEnumType1 UMETA(DisplayName = "EMyEnumType1"),
EMyEnumType2 UMETA(DisplayName = "EMyEnumType2"),
EMyEnumType3 UMETA(DisplayName = "EMyEnumType3")
};
USTRUCT(BlueprintType)
struct FMyStruct
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite, Category = "TestStruct")
EMyEnumType AUEnum;
UPROPERTY(BlueprintReadWrite, Category = "TestStruct")
int32 Aint;
UPROPERTY(BlueprintReadWrite, Category = "TestStruct")
int32 Aint2;
};