Pass a reference to a button that opened the menu this script is on
I have a menu with two big buttons with an image component. It's a "hotseat" menu and each of those buttons allows each of the two players to select their character, each button has the same "On Click ()" event that opens another smaller menu with a choice of several characters.
On the new menu the characters are represented by buttons with image components. At the top of the menu is a slightly bigger "preview" image component that shows the currently selected character. I have a script setup on each button that, when it is clicked, changes the sprite of the preview image to the sprite of the button.
The menu has a "Back" button that closes it. I want to pass a reference to the button that opened the menu, so that when it is closed it will change the sprite of the button that opened it to the current sprite of the "preview" image.
I'd say I know my way around a script, more or less, but I don't know how to "store" a variable in Unity, so that I can tell my script to just change the sprite of "ButtonThatOpenedTheMenu".
Your answer
Follow this Question
Related Questions
help for C# ; when all were green 1 Answer
Make enemy patrol without Nav Points? 0 Answers
random spawn enemy problem 0 Answers