Hello!
I’ve been trying to figure out how to get two different Widgets to talk to each other. Lets call one General UI and the other Total. When i press buttons in the General UI i want the number on Total to change accordingly, as an example add or subtract from it, but for the life of me i can’t get those 2 to talk to each other. I have tried with BP Interfaces, even event dispatchers and creating just custom events. So if anyone could give me a hint or point me in the right direction that would be much appreciated!
With a reference to the other one, functions and variables can be accessed. So, store a reference to one after it is made. If it’s just a Widget Reference you’ll need to cast it.
However, I think a much better solution is not to require UMG Wdigets to access each other. Instead save your variables in a GameMode, GameState, GameInstance, or PlayerController even, create a binding to the Widget element that gets the needed value from that.
That helped a lot, sorry i didn’t respond sooner. I was able to store the variables successfully through a GameInstance that i created my self. Now i can’t figure out for the life of me how to get it to keep the changed value. Every time i recall the Widget it resets the text box to it’s default value. What i mean is, even if after pressing the buttons and changing it to let’s say from Text Box to 50, when i close the widget and recall it, it will still be Text Box. What am i missing?
Sorry if it’s a simple answer, I’m still a complete beginner with it, loving it though!
Cheers, Shadur!
EDIT: Nevermind, was able to figure it out finally! I just created a new function in my UI Event Graph. which I ran with the Event Construct and that would set the value stored in the variable which was in my GameInstance. Thanks a lot for the help and info, it helped a bunch!