I’ve attached 2 screenshots just so to understand how UI works.
I want Widget A to get the value from Widget B and then updates the value of A with the new value. Widget A only contains 1 variable “A” having a value of 0. Widget B only has a variable called “B” having a value of 5.
I want to know how I can make them communicate with each other so that when I press the button the value of the A changes to the value of the B.
Note: I’ve watched several videos on the Internet about having a third person character or first person character and then “Cast to” and all. But I don’t have those. I wanna know how to pass a variable when there is no First Person or Third person character.
You can use event dispatcher inside your widget that will be triggered when you update your value text.
If you created your 2 widget inside your player controller, you can (bind) your event dispatcher using thier reference. (or a similar way, this was just an example on how you could use event dispatcher)
The level starts with level blueprint creating both Widget A and B but only adding Widget A to viewport shown in the 1st photo. In Widget A, I’ve created a Event Dispatcher like the 2nd photo. Then in the third one (Widget B), I’ve created a bind to the dispatcher to just print a statement “Hello” for now.
I’ve trying to use this “Cast To” with countless tries for a while now but it always comes down to this specific error you can see in the 3rd photo. That doesnt accept any input in the “Object” reference. I’ve tried linking “Player Controller”, “Player Character” and “Pawn” but it still shows Error.
Also tried creating the Widget A in Player Controller, it being a reference to Widget A and then tried to link with the “Cast To” node but this error doesnt go away.