Download

Blueprint's inherited component's properties not showing

Hello everyone,

I’ve created a new C++ class that exposes a USphereComponent to the editor, as seen below:
**
Ball.h**



UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
  USphereComponent* VisibleComponent;


Ball.cpp



ABallPlayer::ABallPlayer()
{
	PrimaryActorTick.bCanEverTick = true;
	RootComponent = VisibleComponent = CreateDefaultSubobject<USphereComponent>(TEXT("VisibleComponent "));
}


I then created a blueprint class (Ball_BP) that extends the Ball class. However, when I select the inherited VisibleComponent component in the blueprint editor, some properties (e.g. Simulate Physics) do not show up in the details pane, as seen in this attachment.

This question is similar to the one in this or this thread, but no answer was given in either of those.

Keep in mind that If I add an instance of the Ball or Ball_BP class into the scene then I am able to see all properties when that instance’s VisibleComponent is selected. How can I edit those properties in the blueprint editor?

The reason I wanted to have this setup is because I prefer C++ to blueprint scripting but at the same time I would like to be able to visualize the location, rotation and other properties of components in the editor, instead of figuring out the correct values in code. From what I know there’s no way to attach a script to a blueprint class (And handle events in C++, in the same way the construction and event graph is handle in the blueprint editor). Let me know if there is a better way.

Thank you,
I appreciate your help

Use UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly) or UPROPERTY(VisibleAnywhere, BlueprintReadOnly)

Thank you! Not sure why but that works. I appreciate your help.

EditDefaultsOnly and other EditXXX type paramters are used when you want the actual value of the variable to be editable. In this case you were making the USphereComponent pointer variable as editable and not its actual contents. So use EditXXX type params when you want to set the value of the whole variable

Ah I see, that makes perfect sense. Thank you!