I’ve seen code written by Epic themselves like this:
UPROPERTY(Stuff goes here)
TSubclassOf<class ASomeActorClass> SomeClass;
And sometimes it works for me too.
Other times I get errors like this:
2>F:\Code\UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2829): error C2027: use of undefined type 'AWR2InventoryPhysical'
2> F:\Code\UnrealEngineProj\Wraith\Source\Wraith\Public\Gameplay2\Characters\Inventory\WR2PickupInventory.h(6): note: see declaration of 'AWR2InventoryPhysical'
2> F:\Code\UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2828): note: while compiling class template member function 'UClass *TSubclassOf<AWR2InventoryPhysical>::operator *(void) const'
2> F:\Code\UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectBase.h(1740): note: see reference to function template instantiation 'UClass *TSubclassOf<AWR2InventoryPhysical>::operator *(void) const' being compiled
2> F:\Code\UnrealEngineProj\Wraith\Source\Wraith\Public\Gameplay2\Characters\Inventory\WR2PickupInventory.h(18): note: see reference to class template instantiation 'TSubclassOf<AWR2InventoryPhysical>' being compiled
2>F:\Code\UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject\Class.h(2829): error C3861: 'StaticClass': identifier not found
Doesn’t matter if I forward declare it at the top of the header file or inline.