It sounds like you don’t always want the result to be true? If this is the case I believe using the sequence node isn’t what you want as it will always set your variable to true since it runs 0 and then 1…
Also, are you removing the UI from parent when you close it or setting it hidden? If you are removing it, Im pretty sure it destroys the widget and therefore your button colour states wont be saved.
Hi Vivalabugz,
Thank you for your reply.
Yes, as you mentioned, I supposed to use “Remove From Parent” to close the Menu. Is there any way to save the selected button state after closing it and re-opening again?
I set the Branch after the “Event Construct” because I would like to created this logical way: There is the function code in the Main Blueprint and if the function is running in 1, the Button will be in A when is pop up. If function is running in 2, the button will be in B.
However, as you said it always set the variable to be true atm.
Ok, without it being too complicated, another thing you can do is before closing save your variable in another blueprint. This way when you open it the first thing you do is access that variable and then set the buttons with that. Before removing from parent you want to save that variable state again
I have created a UI with widget Blueprint. It is about button selection and image changing function.
Now when I open the UI, the default selected button is Button A and When I am selecting Buttion B, something will be changed in the scene. While when I am closing the UI and re-open again, the button background colour is still stay at default colour of Button A however the states of scene is under clicking Button B.
Is there any way to save the selected states of Button B and keep it as the selected background Colour after re-opening?
I have added the code with branch after the Event Construct but it looks that the running result is always true.
Hi Vivalabugz,
That sounds greate for me. However, I would like to open the menu with the Animation of UI each time. If set the visibility for the UI to Hiden, then the animation will not be there after close and reopen again.
You first want to create a boolean per button in the bp that controls the create widget call. Next, in the widget, create a reference variable to the actor that will own the UI. In my case, it was the firstpersoncontroller. Back in the BP that owns the UI, after creating the widget, set the owner variable to the creator of the widget(again, my firstpersoncontroller)
. Now, on construct, you want to check those booleans that we made and set your buttons to whatever state you’re looking for. Then start the animations.