Root component created in c++ does not show it's details in Blueprint details panel

Here is the property I have

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
        UCapsuleComponent* CapsuleComponent;

This is my constructor code:

    PrimaryActorTick.bCanEverTick = false;

    IsSwitchEnabled = false;
    ShouldStayEnabled = false;
    Duration = 2.0f;

    bDestroyProjectileOnReact = true;

    CapsuleComponent = CreateOptionalDefaultSubobject<UCapsuleComponent>(AProjectileSwitch::CapsuleCompName);
    if (CapsuleComponent)
        RootComponent = CapsuleComponent;

And here is how it looks like in Editor in an Blueprint that inherits the class

It’s extremely frustrating. I tried multiple combinations of creating the the component as either default or optiona. Different property specifier. Nothing works. It works fine for any components that are UNDER the root, it doesn’t work for the root itself…


Try this solution at the end of this: Inherited component details not showing - Community & Industry Discussion - Unreal Engine Forums

That answer looks like a horrible hack that I would rather avoid. Besides I already managed to get it working. It looks like Visual Studio has a hard time removing old binaries with 4.17, cleaning the solution and using the implementation like in (for example) ACharacter class’s CapsuleComponent fixed the issue.

What fixed the issue for me was copy/pasting the declaration of my root component exactly how Epic did it with their CapsuleComponent inside ACharacter class and then Cleaning and Rebuilding the solution inside Visual Studio. Not exactly sure if this was it, but after that the properties started showing up.

OK, I found it. Apparenly in 4.17 if I add
CollapseCategories = (“SomeCategory”)
to my UCLASS declaration macro, it will mess up the class in some random ways, including weird behaviour with some categories or fields disappearing completely instead of just collapsing it.

For all of those who did not add a CollapseCategories property, my detail pannel bugged out, because I typed into CreateDefaultSubobject the same name as the root variable name in the parent class.

Just changed that:

RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
	RootComponent = RootSceneComponent;

…into this:

RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootScene"));
	RootComponent = RootSceneComponent;

Good point, strange there were no warnings. Also had to change to TEXT(“Root Component”) (there is a space), and suddenly the pawn, components are working as expected.

I had this issue too, but with a subclass of UCharacterMovementComponent. This solution wasn’t working for me, but thankfully clicking the “Open Selection in Property Matrix” button on the empty details panel allowed me to change the default values, just in a slightly clumsier way.

I found that VisibleAnywhere is required for native component properties to show up in the editor.

change component name in c++ and compile again !