Download

Getting variable from another blueprint? can't figure it out

I’ve tried to figure this out for days and I have read info on the internet but I cannot ever get a reference to a variable I’ve created in another blueprint. I even followed Unreal Engine’s tutorials on youtube but I must be missing something. For example let’s say I have a blueprint “Switch” and a blueprint “Light”. I can’t get reference to Light’s custom variable called “Disabled” inside the Switch blueprint with even adding a variable inside Switch that references to that Light blueprint actor specifically. I’ve tried casting also for that but no luck.

Only way I’ve managed to get a reference to that variable “Disabled” is by creating it via C++ like this:


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Details)
   uint32 bDisabled : 1;

Then I can see it basically in every blueprint as long as I reference the blueprint thats parent class is the custom C++ class.
In C++ this seems pretty straightforward and I don’t really need the blueprint solution anymore but I’m interested how it works that way

How do you do the same with blueprints?

Could you post an image of your blueprint? What you’ve described here should work.

I don’t have the blueprint stuff I tried before but this is how I get it with C++ where “Lamp” is a custom C++ class CMLamp, though in this case “Is On” = “Disabled”
086ab8cbc7782c6e16f7c41e45a68865426c2dcf.png
And this is the Lamp variable to get the reference to another blueprint with CMLamp class
lamp.png

When using blueprint only and trying to find “Is On” Get/Set but it’s not on the list, it’s not on the list either when trying to cast my Lamp which parent class is Actor.
Now that I’m writing this I just figured out, do I need to make a custom class derived from Actor via blueprint just like I’ve done with C++ and if so, how does that work?

have you tried using a bp interface?

Cast in the bp you want the variable the bp you want to take the variable of after the event begin play. Then create a vatiable of the bp. After that just get the bp variable and get the wanted variable. I hope i was clear enough. Sorry i m not english