The Controller for all of your pages. Use only 1 per Canvas.
All Page Management should be done via a single instance of MenuController.
Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
MenuController
Assembly: LlamaSoftware.UI.dll
[DefaultExecutionOrder(1)]
[RequireComponent(typeof(Canvas), typeof(Animator), typeof(CanvasGroup))]
[RequireComponent(typeof(AudioSource))]
public class MenuController : MonoBehaviour
Fields
Declaration
protected Animator CanvasAnimator
Field Value
| Type |
Description |
| UnityEngine.Animator |
|
Declaration
protected Selectable CurrentSelectable
Field Value
| Type |
Description |
| UnityEngine.UI.Selectable |
|
Declaration
protected GameObject CurrentSelectedObject
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
If enabled, will support pressing ESC key to pop pages, and fade out the Canvas (if CanvasGroup is attached) when all pages are popped
Declaration
public bool EnableEscapeToGoBack
Field Value
| Type |
Description |
| System.Boolean |
|
If enabled, will process Tab and Shift+Tab as navigation events similar to what you expect from an HTML page, or forms in general.
Declaration
public bool EnableTabSelection
Field Value
| Type |
Description |
| System.Boolean |
|
FadeOutCanvasWhenNoPagesRemaining
If true, will make the Canvas fade out when all pages have been popped. Pressing Escape again will make the Canvas fade back in.
Declaration
public bool FadeOutCanvasWhenNoPagesRemaining
Field Value
| Type |
Description |
| System.Boolean |
|
The first GameObject you would like the current UnityEngine.EventSystems.EventSystem to select
Declaration
public GameObject FirstFocusItem
Field Value
| Type |
Description |
| UnityEngine.GameObject |
|
When enabled, will force the Menu Controller to retain 1 page in the stack at all times. This overrides the previous property FadeOutCanvasWhenNoPagesRemaining.
This means if both are enabled, the Canvas will never fade out, and OnHide events will never be called.
Declaration
public bool ForceKeepOnePage
Field Value
| Type |
Description |
| System.Boolean |
|
The Page to push on start.
Declaration
Field Value
Declaration
Field Value
| Type |
Description |
| System.Boolean |
|
Declaration
protected Selectable NextSelectable
Field Value
| Type |
Description |
| UnityEngine.UI.Selectable |
|
Declaration
protected const string NO_PAGES_ON_STACK_WARNING = "Trying to pop page when there are none on the stack!"
Field Value
| Type |
Description |
| System.String |
|
Declaration
Field Value
| Type |
Description |
| UnityEngine.Events.UnityEvent |
|
UnityEvent to call when the Canvas becomes active. Will be invoked every time the Page Stack goes from 0 to 1 in size (including on Awake if InitialPage is set).
Also called when FadeIn() is called.
Declaration
Field Value
| Type |
Description |
| UnityEngine.Events.UnityEvent |
|
Declaration
protected Stack<Page> PageStack
Field Value
| Type |
Description |
| System.Collections.Generic.Stack<Page> |
|
Declaration
protected Canvas RootCanvas
Field Value
| Type |
Description |
| UnityEngine.Canvas |
|
Whether or not the Menu should be displayed by default on Start().
Declaration
[SerializeField]
protected bool StartVisible
Field Value
| Type |
Description |
| System.Boolean |
|
Methods
Declaration
protected virtual void Awake()
Declaration
protected virtual void DisableSelectablesOnPage(Page page)
Parameters
| Type |
Name |
Description |
| Page |
page |
Page to disable children of
|
Declaration
protected virtual void EnableSelectablesOnPage(Page page)
Parameters
| Type |
Name |
Description |
| Page |
page |
|
Fade in the root Canvas. Will call any UnityEvents bound to OnShow.
Calls UIAnimationConstants on the connected Animator.
Declaration
public virtual void FadeIn()
Fade out the root Canvas. Will call any UnityEvents bound to OnHide.
Calls UIAnimationConstants on the connected Animator.
Declaration
public virtual void FadeOut()
HandleTabSelect()
Selects the next UnityEngine.UI.Selectable if the UnityEngine.KeyCode.Tab key is pressed,
or the previous one if UnityEngine.KeyCode.LeftShift/UnityEngine.KeyCode.RightShift+UnityEngine.KeyCode.Tab is pressed.
Declaration
protected virtual void HandleTabSelect()
Declaration
public bool IsPageInStack(Page page)
Parameters
| Type |
Name |
Description |
| Page |
page |
|
Returns
| Type |
Description |
| System.Boolean |
|
Declaration
public bool IsPageOnTopOfStack(Page page)
Parameters
| Type |
Name |
Description |
| Page |
page |
|
Returns
| Type |
Description |
| System.Boolean |
|
Remove all Pages from the stack and fades out the Canvas
Declaration
public virtual void PopAllPages()
Remove the top Page from the stack and plays appropriate animations
Declaration
public virtual void PopPage()
Add a new Page on top of the Page stack and plays appropriate animations.
Declaration
public virtual void PushPage(Page page)
Parameters
| Type |
Name |
Description |
| Page |
page |
The Page to add
|
Declaration
protected virtual void SelectFirstSelectable()
Declaration
protected virtual void Start()
Declaration
protected virtual void Update()