StackView
It is a container that can have multiple views (items). Current item is displayed at top.
Note
See also StackViewAnimations.
Methods
void Push(RectTransform newView)
Added new view to the top of the stack.If newView is already in stack it will be moved to top.If newView is current (on top) then nothing will happen.void Replace(RectTransform newView)
Replace the current view with a specified one.If newView is already in stack it will be moved to top.If newView is current (on top) then nothing will happen.void Pop(int total = 1)
Remove total views from top of the stack. The view below the total view becomes the new current view.
void Clear()
Remove all views from stack.
void FirstOnly()
Remove all views except first from stack.
bool Remove(RectTransform view, bool raiseEvents = true)
Remove view without any animations or event.Return true if view was removed; otherwise false.bool Contains(RectTransform view)
Is StackView contains a specified view?Return true if StackView contains a specified view; otherwise false.
Properties (Read-Only)
Current RectTransform
Current view.
Count int
Count of views.
RunningAnimation bool
true if animation is running; otherwise false
Events
OnBeforeCurrentChanged UnityEvent<RectTransform>
OnAfterCurrentChanged UnityEvent<RectTransform>