InputEscapeManager

Input Escape Manager

Manages a stack of actions (input escape entries) that can be executed or popped when an escape event occurs. It allows for managing user input related to escape actions effectively.

Used frequently by UI Framework.

Public Methods

Push

public void Push(Action action, Guid? key = null)

Pop

public void Pop()

Pop

public void Pop(Guid key)

PopWithoutExecute

public void PopWithoutExecute(Guid key)

EscapeActionBase

Utility function to easily push/pop to InputEscapeManager. Stores guid for the action it pushes.

  • Push on OnEnable.

  • PopWithoutExecute on OnDisable.

Public Method

Escape pops the action from InputEscapeManager by executing it.

public void Escape()

Example

Loads PauseMenu escape input performed

using System;
using CupkekGames.Core;

public class PauseMenuEscapeAction : EscapeActionBase
{
    UIPrefabLoader _uiPrefabLoader;
    protected override void Awake()
    {
        base.Awake();

        _uiPrefabLoader = ServiceLocator.Get<UIPrefabLoader>();
    }

    // Implement EscapeActionBase
    protected override void OnEscape()
    {
        _uiPrefabLoader.Instantiate(UIPrefabType.MenuPause);
    }
}

Last updated