I have GameObject and four buttons in it. I want to know index of clicked button.
Then declare a public method (in a script on that GameObject) that takes an int parameter. Hook that up as the event handler for each of the clicked events, and specify whatever index value you like for each one.
(I assume you’ve already gone through the UI tutorials in the Learn section, so you know how to use events.)
2 Likes
But I want do it by script. I mean, script declare which in order is button in hierarchy.
Thank you @Kiwasi . This solved my problem.
1 Like