Array, no? The button does not carry an index and simply does not know where it is in the owning array. The most straightforward and flexible way is to make each button a widget so it can carry data:
- you can add the buttons manually and assign indexes one by one, ofc.
- or get all children of a panel and iterate → assign index
The above would create 51 buttons with ascending indexes, the parent (bottom image) will know the clicked one’s index. You can add additional data to the Event Dispatcher, like the reference of the pertinent button itself, if necessary.

