Blueprint declared public variables not accessible, only C++ declared accessible

Hi Forum,

why can I not access the public variables which I declared in the blueprint editor in my BP?

The BP is a child of my C++ class. The C++ class has one UPROPERTY declared which I can then access from a different blueprint, but I cannot see the variables I declared in the blueprint editor only.

Some variables I created inside the BP editor (not in C++):
image

In C++ I have one variable:

	UPROPERTY(BlueprintReadWrite)
	bool bIsReadyToRender;

When I try to access these variables inside my other BP, I see only the bool variable:

image

Thank you in advance

Edit: Same thing happens with functions as well

You need a child which is a child of the BP(who is a child of the C++ class).
So basically… MyCpp->BPparent->BPchild.

Also make sure the variables aren’t set to be private in the bp editor.

2 Likes

Thank you for your answer. I can again access those variables.

I have an additional question, just wondering if I am missing something…

I have another C++ class (Game Instance) from which again I make a BP. In this BP I create variables which I can access, without making a child out of this BP (Get game instance → cost to the BP… etc. and those variables are listed). Why does it work with this BP but not with the aforementioned BP (the C++ is of class Actor)?

You do not need to make a child BP of the parent BP.
MyClass (cpp) → BP_MyClass is enough.

What you want is a variable/pin type that is derived from (or equal to) the class where variables are defined.
If your variable/pin is of type MyClass, you’ll see variables defined in MyClass (cpp) but not blueprint variables.
If your variable/pin is of type BP_MyClass, you’ll see everything.

If your variable is of type MyClass but you know your actual object is of type BP_MyClass, use a Cast to BP_MyClass node and work with its output pin (which is of type BP_MyClass).

1 Like

What do you mean by “variable/pin type”?

Each variable and graph pin has a type. integer, float, string, object…
And the object type splits into as many subtypes as there are object classes available.

image

In your previous post you did mention it works with your game instance after casting to the BP… It’s the same thing with your actor derived class.

2 Likes

Oh you’re right. Maybe the reference variable I had was to the class itself not the BP…
Casting did not come to my mind as I thought it was already of type BP. That will teach me better naming conventions :smiley:

Thank you!