I have to dynamically add new actors of type AStaticMeshActor to the currently loaded scene in the editor, but I am having some problems doing this.
I followed some stuff I found on spawning actors, and on getting the editor world, but it isn’t working. I am doing basically this:
FVector position;
FRotator rotation;
AStaticMeshActor* newActor = GEditor->EditorWorld->SpawnActor<AStaticMeshActor>(position, rotation);
newActor->GetStaticMeshComponent()->SetStaticMesh(existingMesh);
But the call to SpawnActor() is crashing.
Can anyone help me out?
Thanks!
