User Input
Viewmodel

I added a single variable because I don't give permission to change multiple values at 1 time, since the player is one, he has one mouse, everything else I don't consider valid.
BP_Hotbar

At initialization, the owner itself (not the UI) subscribes to track changes.

When someone changes the value of a variable, the VM owner prohibits any illegal manipulation.
The UI requests the change, and the model changes state. If the abilitiy has cooldown, a check can be added here that prevents the event from triggering in-game, isolating the internal logic from outside interference. In doing so, neither the model nor the VM is aware of the physical button! If the external system needs to request a change, it can request the VM, and set the variable, just as Widget will do. So there is no difference between working from BP or WBP.
I would like to use Dispatcher inside VM, but it works very badly in UE5.4. Maybe UE5.5 will handle events better, then I will rewrite this page.
Widget

To extend the widget, I had to wrap the picture with a button and customize the “View Bindings”. Not a single line of code will be needed in any parts of the interface, which saves a lot of time.
Last updated