PauseMenuView is an abstract UIViewComponent that wires up Continue / Load / Settings / Main Menu / Quit buttons and provides a working OnButtonContinueClicked() (calls LunaNavigation.PopBackStack()). Subclass it for the rest. Buttons are queried and wired in OnUILoaded(root) — PanelRenderer delivers the visual tree asynchronously, so no Awake-time element access.

Pause Menu

Setup

  1. UXML with these button names:
    • ButtonContinue — Continue (handler provided)
    • ButtonLoad — Load Game (abstract)
    • ButtonSettings — Settings (abstract)
    • ButtonMainMenu — Main Menu (abstract)
    • ButtonQuit — Quit (abstract)
  2. Subclass PauseMenuView and implement the four abstract handlers.

API

csharp
namespace CupkekGames.Luna; public abstract class PauseMenuView : UIViewComponent

Methods

MethodDescription
OnButtonContinueClicked()Virtual. Default calls LunaNavigation.PopBackStack().
OnButtonLoadGameClicked()Abstract.
OnButtonSettingsClicked()Abstract.
OnButtonMainMenuClicked()Abstract.
OnButtonQuitGameClicked()Abstract.
OnUILoaded(VisualElement root)Override. Queries the five buttons and wires the click handlers once, on the first panel load. Call base.OnUILoaded(root) if you override.

Example

csharp
using UnityEngine; using CupkekGames.Data; using CupkekGames.Luna; using CupkekGames.Luna.Navigation; using CupkekGames.SceneManagement; public class PauseMenuViewExample : PauseMenuView { [Header("Nav Destinations")] [CatalogKeyConstraint(NavConstants.NavDestinationCatalogId)] [SerializeField] CatalogKey _settingsMenuDest; [CatalogKeyConstraint(NavConstants.NavDestinationCatalogId)] [SerializeField] CatalogKey _loadMenuDest; protected override void OnButtonLoadGameClicked() { if (!_loadMenuDest.IsEmpty) LunaNavigation.Push(_loadMenuDest); } protected override void OnButtonSettingsClicked() { if (!_settingsMenuDest.IsEmpty) LunaNavigation.Push(_settingsMenuDest); } protected override void OnButtonMainMenuClicked() => SceneLoader.Instance.LoadScene(1, SceneTransitionDatabase.Instance.Transitions.GetValue("Fade")); protected override void OnButtonQuitGameClicked() => Application.Quit(); }

Opening the pause menu with Escape

The GameFull sample ships PauseEscapeTrigger (on its GameScope.prefab) — a small MonoBehaviour that wires the global Esc input to LunaNavigation.Push(pauseMenuDest) via an EscapeAction (from CupkekGames.Input). It re-arms itself with _escapeAction.Push() before pushing the pause menu, so after the pause menu pops off the nav back stack the next Esc press finds the handler again.

Use case: opening the pause menu from gameplay with Esc. The handler lives at the bottom of the InputEscapeManager stack — while UI views are open, Esc pops them first; once nothing else is on the stack, Esc reaches the handler and pushes the pause menu.

See also

Settings

Theme

Light

Contrast

Material

Dark

Dim

Material Dark

System

Sidebar(Light & Contrast only)

Light
Dark

Font Family

DM Sans

Wix

Inclusive Sans

AR One Sans

Direction

LTR
RTL