TSubclassOf Static Class fails to initialize?

Hello, I’m having a very strange issue with TSubclassOf. I setup a new UActorComponent class and added this variable in there, then setup everything I needed to in that class, compiled successfully and continued working on other classes. About ten minutes later I compile and it gives me an error(below) that was not occuring in the UActorComponent’s class except that the TSubclassOf variable was failing and cause the component to fail as well.

Error:

My code that uses this variable, is just three valid checks and using it in creating a new object(if its valid of course) and thats it. I am at a loss for what is wrong here, any help is appreciated!

header:

TSubclassOf<class UInventoryItem> EmptyItem;

source(I’m not including repeating lines of code so you get the idea of what is being done):

if (EmptyItem)

Inventory.Add(NewObject<UInventoryItem>(this, EmptyItem));

Hi,

Try to #include “InventoryItem.h” in your source

And declare “class UInventoryItem” in the top of your header

It happen to me sometime when my includes are not good, even if it work the first time because the file was included by compilator from another way.

This worked! Thank you!