Layout
Tab Manager
Switch tab content by index or stable ID
Overview
Tab Manager connects tab controls to content panels, with optional titles and a moving indicator.
Usage
Create the tab setup and populate Tabs.
Give entries stable IDs if scripts should open them by name.
Assign the optional title and indicator objects.
Tips
- Activation Timing chooses whether the new tab activates at the start or end of its incoming animation.
- Directional animation can respond to forward/backward navigation.
- Title and indicator transitions have their own settings.
Public API
Use TabManager in the Evo.UI namespace.
Properties
| Name | Type | Description |
|---|---|---|
CurrentTabIndex | int | Active index. |
CurrentTabID | string | Active tab ID, or an empty string. |
CurrentTab | Tab | Active Tab entry, or null. |
Fields
| Name | Type | Description |
|---|---|---|
tabs | List<Tab> | TabManager.Tab definitions. |
inAnimation | TweenSequence | Evo Tween incoming sequence. |
outAnimation | TweenSequence | Evo Tween outgoing sequence. |
Methods
| Name | Parameters | Description |
|---|---|---|
OpenTab() | int tabIndex, bool animate = true | Opens a tab by index, with optional animation. |
OpenTab() | string tabID, bool animate = true | Opens a tab by ID, with optional animation. |
OpenTab() | string tabID | Opens a tab by ID with animation. |
OpenTab() | int tabIndex | Opens a tab by index with animation. |
OpenNextTab() | None | Opens the next valid tab. |
OpenPreviousTab() | None | Opens the previous valid tab. |
OpenFirstTab() | None | Opens the first valid tab. |
OpenLastTab() | None | Opens the last valid tab. |
AddTab() | Tab newTab | Adds a Tab entry. |
RemoveTab() | int index | Removes a tab by index. |
RemoveTab() | string tabID | Removes a tab by ID. |
RefreshIndicator() | None | Updates indicator position and size. |
BeginTabsEdit() | None | Begins a batch of edits. |
EndTabsEdit() | None | Applies a batch of edits. |
Events
| Name | Type | Description |
|---|---|---|
onTabChanged | UnityEvent<int> | Invoked with the active index. |
Example
using UnityEngine;
using Evo.UI;
public class TabManagerExample : MonoBehaviour
{
[SerializeField] private TabManager target;
private void Start()
{
// Create a tab with the ID "settings" in the Inspector first.
target.OpenTab("settings", animate: false);
target.onTabChanged.AddListener(index => Debug.Log($"Tab {index}"));
}
// Bind a button to reopen this tab with its configured transition.
public void ShowSettings() => target.OpenTab("settings");
}