How can I read the value of a variable from a Widget BP, in a Class BP?

Good day. Im super very new to UE4. Im tyring to create a multipe answer question, visual novel style, using widgets, by trying to get the values of certian variables from the Widget BP to the Class BP.

In the Widget BP, I’ve created Buttons in the Designer Pannel that represent the answers. In the Graph Pannel, on EventClicked, those buttons set boolean variables.

In the Class BP im trying to read what the values of those boolean variables are, so I can use Branch and decipher which choice the player has made. This is what it looks like, and what i’ve tried in the class BP:

Can someone suggest what am doing wrong or missing?

What exactly is the issue you are having? Are you unable to read the variables or is the widget not showing?

By the looks of it all you’ve done is created the widget and not put it anywhere - so while those variables should be readable, it doesn’t look like you’re spawning the widget anywhere and thus unable to click any of the buttons, is that right?

Here is where I set the Widget, add it to the Viewport, wait 1 sec and enable the mouse cursour.

I am able to click the buttons, which are set up in the Widget BP shown in the wbp.png and it works.

The problem is that in the Class BP (cbp01/02.png), whenever it reaches the first Branch and checks if the variable ive set in the Widget BP, after the click is True, it comes out False and can not complete the Branch.

Bump Bump!

part of the problem is that your creating the widget twice. so you are creating one and making it visible then you are creating another and reading the values from it. so to fix your issue you need to get a reference to the one that is added to the viewport to read the values from.

Thanks. That fixed the issue indeed :slight_smile: