Cant control creation of widget with boolean variables after EventBeginPlay

pic1
pic2

Here you can see after the EventBeginPlay I create two widgets one by one. When I create the first widget “Choose initial position”, the button on it makes the default boolean false to true. If it is true, then I create the second widget “Ready to play”. Now the problem is when I click the button on the first widget, I can detect that the boolean from first widget has been true(pic2). However in pic1 the boolean from first widget is still default false! I don’t understand how does it happen. How can I control them?

Hi,

It is happening because the Branch node in your first graph is executed right after you create your first widget, it doesn’t wait for your button to be pressed, so if the default value of your boolean in it is false, the False part of the branch will execute. What you want to do is create the second widget in the button clicked event, or a less efficent solution is to check for the state of the boolean in a tick event, and if it is true, you can create your widget.