Question about UI

SO I would like to make my buttons change based on what Item is being selected… For Example Select apple… Eat, Inspect, Smell, Taste & Drop buttons will show… Select an axe… Equip, Inspect, & Drop buttons show… I am not sure how to implement this logic so the question is How do I achieve this?

  • is this like a RMB context menu where we click on icons?
  • or 3d objects in the world?
  • how do you Select them?

It would be 3d items in the world. When I pick them up, they display in my inventory as an Item slot widget with the info. I then have another widget that pops up when you select the item called item options widget and that is the widget that contains the buttons… I want to change the buttons based on which ever item I’m selecting in the inventory widget (Example: when you select an Apple it displays an eat, Inspect, taste, drop button but if you select lets say an axe the only buttons that will display is equip, Drop & inspect…

Hopefully im making sense

Are you using a menu anchor for this? Because that’s how it would normally be done.


Apart from that - unsure how the item hierarchy is set up but it would be a general matter of:

  • have a list of possible actions (enumerators, most likely) stored in the item, per class. It can be a set or an array if order is important
  • when you populate the anchor (or whatever container you’re using), do so using the item’s list, piping the data into the dynamically created widgets
  • the widgets can dispatch the clicked action to whichever actor is supposed to process it

Again, depending on how you handle inheritance vs interfaces, a dispatcher may be less desirable and interface messaging the actor could work better.

Thanks will give it a go