Download

How do I get a variable in a BP from another BP?

Hi, I’ve been watching YT videos/ other topics for weeks but everything is so specific and I don’t understand.

I have a string variable “Play_Faction_Choice” from a UI Blueprint, made it public, and I don’t know how to take the variable from another BP.
If I type the var name it shows this:
image

I don’t have any “get” function. I’ve seen that I should make a get/set function in a BP interface, but I don’t know how to do that
could someone help me? Thanks in advance.

You can’t automatically just pick up a variable in one BP from another. You need to access the BP first:

image

1 Like

it works!

1 Like

Excellent :slight_smile:

Comms between BPs can happen in various ways, but you always need a reference like this.

The reference can be setup in the actual level sometimes, other times dynamically as we did here.

It’s always a bit more of a fiddle moving data between BPs and widgets or the level BP.

The game instance is good for this, you can use it as a common storage area:

2 Likes

Just remember that the variable in the other blueprint has to be public, if it’s private or local, it won’t work. :wink: