Hi,
I am seeing very odd behavior with actor labels that could be observed in the world outliner.
I have a simple example:
void AMyActor::BeginPlay()
{
Super::BeginPlay();
FActorSpawnParameters spawnParams;
spawnParams.Name = "NewActor";
AActor* actor = GetWorld()->SpawnActor(ADirectionalLight::StaticClass(), &FVector::ZeroVector, &FRotator::ZeroRotator, spawnParams);
}
The resulting actor label will appear as DirectionalLight-1
.
The offending code starts on line 629 in AActor::GetActorLabel()
:
// Don't bother adding a suffix for number '0'
const int32 NameNumber = NAME_INTERNAL_TO_EXTERNAL( GetFName().GetNumber() );
if( NameNumber != 0 )
{
DefaultActorLabel.AppendInt(NameNumber);
}
In this case GetNumber()
returns 0 and the internal to external conversion gets -1 and that’s what gets appended to the label.
Something about this seems odd and perhaps a bug?
Would be great to get some feedback.
Thanks!