CheckBox Widget, how to prevent using all checks at once

Hello,
I have many CheckBoxes in a Widget Menu, how can i prevent the player from checking ALL of them at once ? I want him to be able to select only 2 maximum.

  • create a new widget that represents a checkbox and equip it with an Event Dispatcher:
  • changing state calls the dispatcher

  • add the user widget checkboxes to a panel

334280-addthem.png

  • and in the widet that holds them:


Having checkboxes as user widgets helps a lot, you can give it text, backdrop or any other functionality. And if you need to update the way they look / behave, it’s a matter of doing it once to 1 user widget rather than revisiting every place in every menu and applying changes manually.

There are other ways of doing it, too, surely. Like disabling the checkboxes once limit is reached. The method to use would depend on the desired result and details.

As in, you did not explain what happens when we try to select the 3rd checkbox. Are we physically unable to do it (the above method) or we untick one of the already ticked ones instead to make space for the recently selected.

Thank you, exactly what i wanted :3 This was my biggest scare, i have like 20+ checkboxes used as “inventory items” for a crafting system. And having to do all of them individually …pff …forget about it.