UStruct: type must be a UCLASS, USTRUCT or UENUM

Hello, finally got a working (and clean) solution to this, yet another, unreal programming problem…

The problem:
For some reason, the compiler doesnt like us upropertying its engine’s enums and or structs and complains with a :
" Unrecognized type ‘ENUM or STRUCT’ - type must be a UCLASS, USTRUCT or UENUM ".
Removing the uproperty things makes it work, but…

The solution:
Add TEnumAsByte<your enum>

Example:

Instead of:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SafeSpawnLocator RayCast Config")

TArray<EObjectTypeQuery> SpawnableLayers;

do:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SafeSpawnLocator RayCast Config")

TArray<TEnumAsByte<EObjectTypeQuery>> SpawnableLayers;

This compiles and shows the variables in the inspector \o/

Engine Version: 4.19

3 Likes