The question is answered, right answer was accepted
What is the proper way of keeping track of menus, and using that information to create a back button?
What is the proper way of keeping track of all the menus screens scripting wise, and using that to make a back button. I want to be able to use a key to go back instead of clicking on ui. On the UI you have to manually put in what panel is about to show and which panel you are hiding. With a key down, I am not sure how that works, because there is no definite info to place in since you could be backing out of multiple panels. I've read through many unity docs, and searched most of this evening. I know how to write the key down part. It's for a pc.
Answer by haruna9x · Sep 16, 2017 at 03:23 AM
Use the stack to store "active" menus.
When opening a menu, add it to the stack, and it will be overlaid on top of other menus. You can add a few options such as disable or disable the interaction of the menu below.
When closing a menu, delete it from the stack, obviously can only close the menu at the top. And you open it in any order, it will close it in reverse order. Also remember that the menus below may have been disable or turned off interactivity.
So the back button simply closes the menu on top.
Thank you, you led me in the direction I needed to be in.
Follow this Question
Related Questions
Move UI panel on and off screen, scripted without animation 0 Answers
Using downloaded image as UI Image's source image? 1 Answer
ObjectReference Not set to an instance of an object 1 Answer
Best way to simplify this code 1 Answer
All transform.position has the same value in the Start method 0 Answers