TArray = type must be a UCLASS, USTRUCT or UENUM-

Hello, I’ve got a blueprinttype struct with various UProperty data in it. Then on the Enemy class I have:

UPROPERTY(EditAnywhere) TArray<struct FEnemyAttack> Attacks;

It’s worked perfectly up until upgrading to 4,17. Now it gives the following error:

StateError Unrecognized type 'FEnemyAttack' - type must be a UCLASS, USTRUCT or UENUM

I’ve tried including the struct header to this Enemy.h, and including it to the main Project.h. I can’t figure out how to get this working again.

Any suggestions?

Inside your header file, try to declare your struct then use it in a TArray like this

USTRUCT(BlueprintType)

struct FTestStruct
{

GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "TestStruct")
		FString strValue;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "TestStruct")
		FTransform transformValue;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SaveLoadData")
		float floatValue;
};

TArray <FTestStruct>  testStructArray;

Note that you should leave no space inside angle brackets.
You got this error becasue if i remember it right, new version demand that if you use a function that exposed to blueprint, enum have to be exposed to blueprint as well.

It is already exposed to blueprint though.
Edit: I found out the real problem… There was an include-loop, causing that incorrect error report

My class with most of the structs “CustomStructs.h” has a a parameter somewhere like this:

	UPROPERTY(EditAnywhere, Category = "AKQ_Interaction") TMap<TSubclassOf<class AEnemy>, int32> EnemySpawns;

All of a sudden UE4 is saying that AEnemy is undefined. So because of that I included Enemy.h at the top. I figured there was some sort of loop going on, since my Structs.h was including Enemy.h, and my Enemy.h was now including my Structs.h

I moved the whole struct that needed to include Enemy.h into another file, which broke the loop, and made everything work!

Although there was a different solution, thanks for the answer. I’ll mark it as correct as it may be a valid answer for someone else with a similar problem.