Animation
Popover
Toggle a small panel with animated open and close states
Overview
Popover controls a panel that opens near a trigger, such as a compact settings panel or extra actions. V2 uses Evo Tween sequences for both directions.
Usage
Add Popover to the panel.
Configure its initial state and open/close sequences.
Bind the trigger’s click to Toggle().
Choose whether outside clicks and Escape close it.
Notes
Manage GameObject State lets the component handle panel activation. Adjust the sequences for movement, scale, and fading.
Public API
Use Popover in the Evo.UI namespace.
Fields
| Name | Type | Description |
|---|---|---|
isOpen | bool | Current open-state field; use methods to change it. |
closeOnOutsideClick | bool | Closes on an outside pointer click. |
closeOnEscapeKey | bool | Closes on Escape. |
openAnimation | TweenSequence | Evo Tween opening sequence. |
closeAnimation | TweenSequence | Evo Tween closing sequence. |
Methods
| Name | Parameters | Description |
|---|---|---|
Toggle() | None | Toggles open/closed state. |
Open() | None | Opens with animation. |
Close() | None | Closes with animation. |
SetStateImmediate() | bool open | Sets state without animation. |
Events
| Name | Type | Description |
|---|---|---|
onStateChanged | UnityEvent<bool> | Invoked with true for open or false for closed. |
Example
using UnityEngine;
using Evo.UI;
public class PopoverExample : MonoBehaviour
{
// Keep this controller outside the panel if closing deactivates it.
[SerializeField] private Popover target;
private void Start()
{
target.SetStateImmediate(false);
target.onStateChanged.AddListener(OnStateChanged);
}
// Connect these methods to the opening and closing buttons.
public void ShowPanel() => target.Open();
public void HidePanel() => target.Close();
private void OnStateChanged(bool open)
{
Debug.Log($"Popover open: {open}");
}
private void OnDestroy()
{
if (target != null)
target.onStateChanged.RemoveListener(OnStateChanged);
}
}