Animation
Popover
An animated overlay component with outside-click and escape-key dismissal
Overview
Popover displays a UI element with animated entry and exit transitions. It supports multiple animation types, automatic dismissal on outside clicks or the escape key, and optional GameObject lifecycle management, making it ideal for tooltips, dropdowns, and contextual menus.
Usage
Select a UI object to use as the popover panel
Add the Popover component (CanvasGroup and RectTransform will be added automatically)
Choose an Animation Type and configure timing and curve as needed
Call Open(), Close(), or Toggle() from a button or script to control visibility
Properties
Settings
| Name | Type | Description |
|---|---|---|
isOpen | bool | Whether the popover starts in the open state |
manageGameObjectState | bool | Automatically activates/deactivates the GameObject when opening or closing |
closeOnOutsideClick | bool | Closes the popover when the user clicks outside of it |
closeOnEscapeKey | bool | Closes the popover when the Escape key is pressed |
Animation
| Name | Type | Description |
|---|---|---|
animationType | AnimationType | The style of animation to use: None, Fade, Scale, or Slide |
animationCurve | AnimationCurve | Easing curve controlling animation progression |
animationDuration | float | Duration of the open and close animations in seconds |
scaleFrom | float | Starting scale factor for the Scale animation type |
slideOffset | Vector2 | Positional offset the panel slides in from for the Slide animation type |
Events
| Name | Type | Description |
|---|---|---|
onShow | UnityEvent | Invoked when the popover begins opening |
onHide | UnityEvent | Invoked when the popover begins closing |
Enums
AnimationType
| Value | Description |
|---|---|
None | Instantly shows or hides the popover with no transition |
Fade | Fades the canvas group alpha in or out |
Scale | Scales and fades the panel from scaleFrom to full size |
Slide | Slides and fades the panel in from a positional offset |
Public Methods
| Name | Parameters | Description |
|---|---|---|
Open() | None | Opens the popover with the configured animation |
Close() | None | Closes the popover with the configured animation |
Toggle() | None | Opens the popover if closed, or closes it if open |
SetStateImmediate(bool open) | open — target state | Instantly snaps the popover open or closed without playing any animation |
Code Example
using UnityEngine;
using Evo.UI;
public class PopoverExample : MonoBehaviour
{
public Popover popover;
void YourMethod()
{
// Configure dismiss behavior
popover.closeOnOutsideClick = true;
popover.closeOnEscapeKey = true;
// Configure animation
popover.animationType = Popover.AnimationType.Scale;
popover.animationDuration = 0.2f;
popover.scaleFrom = 0.8f;
// Subscribe to events
popover.onShow.AddListener(() => Debug.Log("Popover opened"));
popover.onHide.AddListener(() => Debug.Log("Popover closed"));
// Open the popover
popover.Open();
// Toggle animation
popover.Toggle();
// Instantly close without animation
popover.SetStateImmediate(false);
}
}