![]() |
BomberUnits
...a Unity learning project
|
This is a How-To for the concept of Menu page System, with components explained on its architecture site here: The Menu Page System.
Please note this concept is responsible for hiding or showing different parts of a UI. It can also be used to implement actual menu pages. The switching of pages could be done by utilizing a state machine approach. In BomberUnits, the main menu has its own state machine, with each state corresponding to a menu page as introduced here.
There is a test scene to look at with this How-To: Assets/Test/MenuAnimationWithLayoutsTest.unity
UIManager to organize the logics between page transitions. It decides which menu components should switch when, using the provided callbacks. This logic is however not part of this How-To. Just be aware that you will need to register function callbacks to your buttons which can trigger page switches directly or activate some other mechanism, such as a full menu state machine.MainHLayoutElement3LayoutContainerElement3, need the Animator and MenuElement components.Animator component the MenuElementTransition controller asset.MenuElement's Container field if any. This is needed so the container can be disabled when the element is disabled. This will change the organization of the enclosing Layout Group, so don't give a reference to the container if you don't want it to be disabled when the element is hidden (see in the example: container setting is empty).MenuPage component. These can represent menu pages but don't necessarily have to. You should group your logical pages under its own parent, e.g. Pages. should be handy.Hint: The page inspector provides a toggle to show or hide the page GameObject while editing, which