Starting on UI and figuring out UMG. One question I have is…
How do I keep the UI consistent across the whole game?
If I want to change the font for a button, or background color, or button size, how do I maintain dozens/hundreds of buttons without manually modifying each individual instance? Equivalent to CSS style sheets I guess.
You can create widgets as buttons. Not sure how it works with “when button clicked.” Then if you put 100 buttons into one menu, all you need to do is to change the master button.
Variables can be flagged as Instance Editable, this will expose them once the widget becomes a child. A *text type *variable can be bound to a text block field, for example - directly editable by the parent.
When it comes to click events, it kind of depends on what the goal is. Some widgets already have click events (buttons), some allow you to bind a function and return a value (borders) - telling other widgets how you handled input, some widgets do not have events default (text block). But User Widget can override a lot of methods. So even though you’re not really supposed to double click a text block, nothing stops you from wrapping one in a widget and override double click there.
Communicating with the child is pretty straightforward since the parent already has a direct reference and can call custom events, edit variables, access pretty much anything directly; sending data back to the parent is where Event Dispatchers shine as their events are directly available on the parent.