Object null when in datatable?

Hello,

I have made a struct with a TAssetSubclassOf. So now I can assign a blueprint actor from the content browser in my datatable. But when the actor self is not placed in the scene it can’t be loaded. So I first need to place the actor in the scene before it succesfull can load.

FObjectsStructs* MyObject = ObjectsData->FindRow<FObjectsStructs>(FName(*ObjectID), ContextString);

		
UE_LOG(LogTemp, Warning, TEXT("Path: %s"), *MyObject->Object->GetName());
1 Like

So, what is the question?
Is it why you can’t reference any uninitialized object which is null?

The question is why does the object need to be in the scene when I try to spawn the actor? I have assigned it from the editor in the datatable.

AActor* SpawnedActor = GetWorld()->SpawnActor(MyObject->Object->GetDefaultObject()->GetClass(), GetActorLocation(), GetActorRotation(), SpawnInfo);

1 Like