Hey, AActor::GetName is not returning the name of my Actors inside the editor. They have additionally appended an underscore and a number:
Editor: Sun
AActor::GetName: Sun_6
How comes this, and how can I prevent it?
Hey, AActor::GetName is not returning the name of my Actors inside the editor. They have additionally appended an underscore and a number:
Editor: Sun
AActor::GetName: Sun_6
How comes this, and how can I prevent it?
I see that GetActorLabel works well, but only in debug.
How can I set which name my actor has at the beginning?
Is there any particular reason why you need an engine function that returns the string without the appended “_6”?
If not, why not just modify the string to remove the appended information that you don’t require?
I only wanted to know, why it is 6 and not 8, so what determines the number after the _
GetName is returning the actual name of the object, which for lack of a naming by you in SpawnActor or ConstructObject is the class name and a monotonically increasing number.
FActorSpawnParameters has a Name variable for setting an actor name
ConstructObject takes a name as the 3rd parameter
If you want the class name, then UYourClass::GetClass()->GetName(), but obviously that is not unique
I did a bit of the survey to figure out all kind of methods available to get name of actor or component. Here are few notes:
MyCppPawn /Game/FirstPersonCPP/Maps/UEDPIE_0_FirstPersonExampleMap.FirstPersonExampleMap:PersistentLevel.MyCppPawn10
and for StaticMeshComponent it would return StaticMeshComponent /Script/Engine.Default__DefaultPawn:MeshComponent0
.UKismetSystemLibrary::GetDisplayName()
which returns label in editor mode otherwise owner.GetName() + component.GetName().ActorHasTag(name)
method.Thank you for doing this. This is the sort of information that should be in the official documentation. Knowing that the name is not stable is very valuable.
If you hover over the object in the World Outliner, it will show the “ID Name”. This is what AActor::GetName() is returning.