Child Actor Component Empty Details Panel in Parent Blueprint

I’ve been following along with Epic’s C++ Tanks vs. Zombies demo stream on YouTube. There, they define a Child Actor Component for their pawn in C++, and, when they create a Blueprint based off of their C++ code, they can select the Actor to function as the child by selecting the component in the Blueprint Editor Viewport and selecting the desired asset in the Details panel.

However, when I replicate their steps, I do not get a populated Details panel on my Child Actor Component. The panel is empty, and I cannot access the values for the component; so I cannot set it through the Blueprint to the desired actor.

I can find my Get Child blueprint node in the Graph Editor when I search, and it is even under the category I defined it as. Its tooltip shows as the comment directly above my definition of the component, so I’m sure it’s referencing the correct thing.

Still the Details panel is empty, so the Child Actor Component is functionally useless.

Here’s a screenshot.

Here’s my code for your reference.

.h file:

#pragma once

#include "GameFramework/Pawn.h"
#include "PlayerGodPawn.generated.h"

UCLASS()
class PROJECTJUPITER_API APlayerGodPawn : public APawn
{
	GENERATED_BODY()

    // Constructor declaration
    APlayerGodPawn(const FObjectInitializer& ObjectInitializer);
    
public:
	// Sets default values for this pawn's properties
	APlayerGodPawn();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

private:
    // Declare that we'll use a Scene Component called Dummy Root (it will be used for the root of the Actor)
    UPROPERTY()
    USceneComponent* DummyRoot;
    
    // Declare that we'll be adding a child actor component, which will have the skeletal mesh for the hand representing the player's position in the world
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Hand", meta = (AllowPrivateAccess =  "true"))
    UChildActorComponent* ChildHand;
	
};

.cpp file:

#include "ProjectJupiter.h"
#include "Components/ChildActorComponent.h"
#include "PlayerGodPawn.h"


// Sets default values
APlayerGodPawn::APlayerGodPawn(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
 	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

    // Default root component needed for C++ classes; Blueprints create one on the fly
    RootComponent = DummyRoot = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("RootComponent"));
    
    // Use a spring arm to give the camera smooth, natural-feeling motion.
    USpringArmComponent* SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraAttachmentArm"));
    SpringArm->SetupAttachment(RootComponent);
    SpringArm->RelativeRotation = FRotator(-65.f, 0.f, 0.f);
    SpringArm->TargetArmLength = 1000.0f;
    SpringArm->bEnableCameraLag = true;
    SpringArm->CameraLagSpeed = 3.0f;
    
    // Create a camera and attach it to our spring arm
    UCameraComponent* Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("PlayerCamera"));
    Camera->SetupAttachment(SpringArm, USpringArmComponent::SocketName);
    
    
    // Attach the ChildActorComponent
    UChildActorComponent* ChildHand = CreateDefaultSubobject<UChildActorComponent>(TEXT("PlayerHand"));
    ChildHand->SetupAttachment(DummyRoot);
    
    
    // Take control of the default player
    AutoPossessPlayer = EAutoReceiveInput::Player0;
    
}

// Called when the game starts or when spawned
void APlayerGodPawn::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void APlayerGodPawn::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

// Called to bind functionality to input
void APlayerGodPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
    Super::SetupPlayerInputComponent(InputComponent);
}

Am I setting something up wrong?

This probably was changed in later version. Instead of ‘meta’, just try moving your vars from ‘private’ undo ‘public’ or ‘protected’

Any luck finding a soloution? I´m experiencing the exact same issue…

Apparently there is an ongoing thread about a very similar issue here:
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/57024-inherited-component-details-not-showing-in-blueprint/page2

Epic has since opened a bug report, and are working to resolve it. I hope this will resolve the behaviour you see described here, too.

It’s also possible I just set something up wrong. I’m still working on a situation much like this right now and trying to figure out how to get my UComponents to show up in a derived BP’s Details panel for them.

I think looking at the constructor code, this old thread looks like the person was creating another local variable called ‘ChildHand’.

// Attach the ChildActorComponent
     UChildActorComponent* ChildHand = CreateDefaultSubobject<UChildActorComponent>(TEXT("PlayerHand"));
     ChildHand->SetupAttachment(DummyRoot);

Thanks for the update. For now I gonna stick with compiling my code in VS before opening Unreal Engine Editor. This way it works for me. I think the issue might be somewere in the hot reload for C++ Code.

After two years, one brilliant mind showed me the solution!

It turns out, I was doing variable declarations wrong. Allow me to elaborate:

.h file:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
class USkeletalMeshComponent* MeshComponent;

.cpp file:
RootComponent = CreateDefaultSubobject(TEXT(“RootComponent”));

USkeletalMeshComponent* MeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MeshComponent"));
MeshComponent->SetupAttachment(RootComponent);

This causes issues, because both in the .h file and in the .cpp file, the variable is declared and memory is reserved for both. The MeshComponent in the .h and the MeshComponent in the .cpp are not the same variables when implemented this way. That’s why we do get a Component added to our Blueprint, but it’s not showing up as an editable value (because it’s not been told that it wants a UPROPERTY()).

So, instead, we need to change our .cpp file to this:
RootComponent = CreateDefaultSubobject(TEXT(“RootComponent”));

MeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("MeshComponent"));
MeshComponent->SetupAttachment(RootComponent);

See the subtle difference? The type specifier is no longer present in the .cpp file.

For some reason, the problem I had seemed to be that components declared in-line in the .cpp file do not get their variables added to the Details panel. Instead, I need to manually specify for each Component that it’s a UPROPERTY() in the .h file.

Unfortunately, my RootComponent still has a blank Details panel. Still figuring out why that is.

I hope this helps someone else somewhere down the line.

2 Likes

See the answer I posted just now. It may help if you happen to have the same setup.

I just wanted you say this solution worked. Thank you so much.