Hello, I am working on a game right now, and I’m kind of stuck.
It would take too much time to explain what I’m trying to do exactly, so I’ll use fruits to simplify it.
Basically, I have manually populated a sprite list with the following fruits:
Element 0: Apple
Element 1: Strawberry
Element 2: Peach
Element 3: Orange
Element 4: Lemon
Element 5: Banana
I am instantiating a prefab with an image component and a script on it. On start, I load these sprites randomly on the screen inside of a scrollview as buttons with the associated images.
Now, my question is, how could I get the index number of each button that I press? For example I press the button with an orange on it, how could I return 3? By the way these buttons are only present when I start the game.
Thanks in advance.