Why isn't spawned actor name correct in outliner?

I’m spawning an actor at runtime with GetWorld()->SpawnActor and I set the name of it in FActorSpawnParameters to something, but when I play in the editor and look in the outliner the name of it is not displayed. It displays the name of the actor class and “-1” after it for all the actors I spawn. I’ve checked that GetName() returns the name I set after I spawn the actor, and it does.

Any ideas? Where does the outliner get the displayed name from?

Found it: The outliner uses the ActorLabel and not the object name. You can set the actor label with SetActorLabel(FString)

1 Like