Its possible to create a "N" number of buttons automatic in a widget ?

You can create native buttons but that’d be awkward to use.


Consider the following instead:

  • a User Widget with just a native button, a material variable and an Event Dispatcher:

  • another widget creates a bunch of our custom buttons, feeds each a material from the array, adds them to a Horizontal Box and registers a dispatcher call:

Note how we do not need to faff around with indexes; each button knows the exact material it’s supposed to assign to the mesh. Less room for errors! As a bonus, if you ever want to change how buttons looks like, you need to change 1 button only rather than chase around a dozen menus and change 50 buttons.


and sets up a dispatcher call

This last part can be done even better, you could have an event inside the actor that owns the primitive component and directly bind to that instead. Do tell if you’re interested.

1 Like