as simple this BP is, i have issue with it, once i click the button it printing as the following:
0
1
0
1
0
1
why its printing the default value while i change it as photo attached, this is the simple thing i could get to clarify my issue, am i doing something wrong here or i missed something ?
there’s no other place the active button value change only here.
Hello @matrex_a1990
My best guess would be that you created more then one widget of this class. Both are added to viewport but the one created last would the one you are changing the int value on.
Best to verify with something like this, then go back to widget creation logic and review what’s going on.
i think yes, but i don’t know why its behave like this, as i know i should add it to the pawn to get the UI display on my screen, am i doing it right or it should be done in different way ?
It hard to know for sure without seeing the bigger picture.
I wouldn’t say it’s wrong or right way, but for some reason you run this logic twice. Do you have two of these in your level, do you destroy and then create another one?
You could do it in Player Controller or use Do Once node, but the latter isn’t really a fix, more of a work around/hack in this case. But it won’t work if you run it from two different pawns.
Try doing it on Player Controller for now, since that would be the quickest and easiest solution, given what we know. If you don’t have a controller class yet, create a new player controller and assign in your game mode (otherwise the default one will be created and used). Advantage of doing it in controller is that every player has only one.
thanks alot for help, its worked now, i wasn’t have a hud and that’s create my issue, i follow this tutorial help me solved it
Set Up HUD & UI Widget - Unreal Engine 5 Tutorial [UE5]
Awesome, well done.


