Download

Component Window showing incorrect name of components

Hi,

I have code creating a new USceneComponent to use as the root of an AActor


RootSceneComponent = objectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("My New Root Component"));

When I create this actor in the level, the components window in the editor shows its name as “RootSceneComponent”, not the name I provided.

2f8644419c6d880e5a8d79901e7e850a.png

If I run the game and check in the Tick() function, the RootSceneComponent->GetName() correctly prints out “My New Root Component” but it is still wrong in the inspector.
If I execute a RootSceneComponent->Rename(TEXT(“My New Root Component”)) within the Tick() this changes the inspector to show the correct name.

Is there something I’m missing to make it show the correct name in the editor inspector without running the game?

Here’s the whole constructor…



{
     // Set this actor to call Tick() every frame
    PrimaryActorTick.bCanEverTick = true;

    // Create a scene root component as the root of our component heirachy
    RootSceneComponent = objectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("My New Root Component"));

    // Set default mobility settings for the root component
    RootSceneComponent->Mobility = EComponentMobility::Movable;

    // Make the root component show a visible marker in Editor mode
#if WITH_EDITORONLY_DATA
    RootSceneComponent->bVisualizeComponent = true;
#endif

    // Set the new scene component as the default Root Component on the actor
    this->SetRootComponent(RootSceneComponent);
}