Logo
UI Elements

Modal Window

Present a focused confirmation or message

Overview

Modal Window presents a title, description, optional icon, and confirm/cancel actions. Open and close animations use Evo Tween sequences.

Preview

Usage

Create a Modal Window prefab.

Set its content and configure confirm/cancel callbacks.

Choose whether it disables or destroys itself when closed.

Call Open() from the action that displays it.


Tips

  • Use Focused navigation when selection should stay inside the modal, or Free navigation for normal selection behavior.
  • Edit the open and close sequences for motion and fading.
  • When an action needs validation, disable Close On Confirm. Keep the window open while the input is invalid, then close it after validation succeeds.

Public API

Use ModalWindow in the Evo.UI namespace.

Properties

NameTypeDescription
TitlestringDisplayed title.
DescriptionstringBody text.
IconSpriteOptional icon.
IsOpenboolRead-only open state.

Fields

NameTypeDescription
closeOnConfirmboolCloses after confirmation.
closeOnCancelboolCloses after cancellation.
closeBehaviorCloseBehaviorDisable or Destroy after closing.
navigationModeNavigationModeFocused or Free selection behavior.

Methods

NameParametersDescription
Open()NoneOpens the window.
Close()NoneCloses with its configured animation.

Events

NameTypeDescription
onOpenUnityEventWindow opened.
onCloseUnityEventWindow closed.
onConfirmUnityEventConfirm action invoked.
onCancelUnityEventCancel action invoked.

Example

ModalWindowExample.cs
using UnityEngine;
using Evo.UI;

public class ModalWindowExample : MonoBehaviour
{
    [SerializeField] private ModalWindow target;

    private void Start()
    {
        target.Title = "Leave this screen?";
        target.Description = "Your saved progress will be kept.";
        target.onConfirm.AddListener(() => Debug.Log("Confirmed"));
        target.Open();
    }
}

On this page