As stated in the title
got that code
TSubclassOf<class UInventoryItem> DataObjectClass;
That i want to later use in BeginPlay
void AInventoryOnTheGround::BeginPlay()
{
Super::BeginPlay();
DataObjectInstance = DataObjectClass->GetDefaultObject<UInventoryItem>();
}
But starting the game crashes the engine with access violation 0x00000005 exeption
Why is that and is there any other way to create a UObject from TSubClassOf?