Evo uiUi elements
Modal Window
A flexible popup window
This page documents Evo UI v1. For the current version, see Evo UI v2. Upgrading? Read the migration guide.
Overview
Modal Window displays a popup with a title, description, icon, and confirm or cancel buttons. It supports multiple animation styles, custom content, and navigation options.
The component is ideal for confirmations, warnings, dialogs, item details, or any focused user interaction that requires pausing background UI.

Properties
Content
| Name | Type | Description |
|---|---|---|
icon | Sprite | Icon shown at top of modal |
title | string | Title text |
description | string | Body description text |
customContent | bool | If enabled, content will not be auto assigned |
Animation
| Name | Type | Description |
|---|---|---|
animationType | AnimationType | None, Fade, Scale, Slide |
animationDuration | float | Duration of open or close animation |
animationCurve | AnimationCurve | Easing curve |
scaleFrom | float | Starting scale when using Scale animation |
slideOffset | Vector2 | Offset used by Slide animation |
Settings
| Name | Type | Description |
|---|---|---|
useUnscaledTime | bool | Use unscaled time for animation |
closeOnConfirm | bool | Closing after confirm button is pressed |
closeOnCancel | bool | Closing after cancel button is pressed |
startBehavior | StartBehavior | Open or Disabled on start |
closeBehavior | CloseBehavior | Disable or Destroy on final close |
navigationMode | NavigationMode | Free or Focused navigation restriction. When set to focused, UI Navigation will be restricted to Confirm and Cancel buttons only. |
References
| Name | Type | Description |
|---|---|---|
contentParent | RectTransform | Container holding visual content |
iconImage | Image | Icon renderer |
titleText | TextMeshProUGUI | Title label |
descriptionText | TextMeshProUGUI | Description label |
confirmButton | Button | Confirm button |
cancelButton | Button | Cancel button |
Events
| Name | Type | Description |
|---|---|---|
onOpen | UnityEvent | Called after modal opens |
onClose | UnityEvent | Called after modal closes |
onConfirm | UnityEvent | Called when confirm button is pressed |
onCancel | UnityEvent | Called when cancel button is pressed |
Public Methods
| Name | Parameters | Description |
|---|---|---|
Open() | None | Plays open animation and shows modal |
Close() | None | Plays close animation and hides or destroys modal |
SetTitle(text) | string | Updates title text |
SetDescription(text) | string | Updates description text |
SetIcon(sprite) | Sprite | Updates icon and visibility |
IsOpen | Returns true if modal is currently open |
Code Example
using UnityEngine;
using Evo.UI;
public class ModalWindowExample : MonoBehaviour
{
public ModalWindow modal;
void Start()
{
// Update content
modal.SetTitle("Delete File");
modal.SetDescription("Are you sure you want to delete this file?");
modal.SetIcon(warningSprite);
// Add events
modal.onConfirm.AddListener(() =>
{
Debug.Log("Confirmed");
});
modal.onCancel.AddListener(() =>
{
Debug.Log("Cancelled");
});
// Open modal
modal.Open();
}
public void ShowModal()
{
modal.Open();
}
public void HideModal()
{
modal.Close();
}
}