Why does UPROPERTY() cause my struct type to become unrecognized?

I have a simple struct declaration in my .h:

FSpellBook DefaultSpellBook;

Which compiles just fine.

But I want to be able to set the variables within the struct in the editor, so I did this:

UPROPERTY(EditAnywhere) FSpellBook DefaultSpellBook;

Which does not compile, and instead throws this error:

error : In DMagicGameMode: Unrecognized type 'FSpellBook'

This is the struct:

USTRUCT(BlueprintType)
struct FSpellBook
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere)	int32 SpellSetCount; 

	UPROPERTY(EditAnywhere)	int32 SpellsPerSetCount[5];

	UPROPERTY(EditAnywhere)	int32 SpellLevelMax;

	UPROPERTY(EditAnywhere)		TSubclassOf<class ASpell>InnateSpellClasses[3];
	UPROPERTY(EditAnywhere)		TSubclassOf<class ASpell>SpellSetClassesA[3];
	UPROPERTY(EditAnywhere)		TSubclassOf<class ASpell>SpellSetClassesB[3];
	UPROPERTY(EditAnywhere)		TSubclassOf<class ASpell>SpellSetClassesC[3];
	UPROPERTY(EditAnywhere)		TSubclassOf<class ASpell>SpellSetClassesD[3];

	UPROPERTY(EditAnywhere)		int32 UnlocksSetA[3];
	UPROPERTY(EditAnywhere)		int32 UnlocksSetB[3];
	UPROPERTY(EditAnywhere)		int32 UnlocksSetC[3];
	UPROPERTY(EditAnywhere)		int32 UnlocksSetD[3];
};

Any idea why adding a UPROPERTY() would cause the compile to fail?

Am I setting up the struct wrong? How do I fix this?

did you include the .h contain FSpellBook, you can try add this

UPROPERTY(EditAnywhere) struct FSpellBook DefaultSpellBook;

Thats UHT error not compiler, it does not detect your struct for some reason, decleration looks ok to me

The include “SpellBookStruct.h” is in my project.h

Adding struct to the declaration had no effect.

EDIT:
Adding SpellBookStruct.h directly instead of in the project.h solved the issue.

Which is weird because this is the only instance in which having the include in the project.h did not work. :confused:

Adding SpellBookStruct.h directly instead of in the project.h solved the issue.

Which is weird because this is the only instance in which having the include in the project.h did not work. :confused:

Adding SpellBookStruct.h directly instead of in the project.h solved the issue.

Which is weird because this is the only instance in which having the include in the project.h did not work. :confused:

My struct fails too. I tried importing it into the project.h but for some reason my save game errors when trying to build. It works when adding it directly to the save game.