UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Gameplay Systems / Pause System Completed

Gameplay Systems — UGTK

Pause System

Summary

The Pause System is the single point that pauses and resumes the game. It freezes time, notifies every object that declared itself pausable, raises two UnityEvents and can react to configurable keys.

The part that makes it convenient: nothing has to register. Implement IPausable on a component and the manager finds it on its own when the pause happens — no subscribe, no unsubscribe, no leak when the object is destroyed.


Content


Modules Dependencies


Setup

Drop the PauseManager prefab into the scene — one per game, it is a singleton:

Then implement IPausable on whatever has to react:

public class Mn_MyEnemy : MonoBehaviour, IPausable
{
    public void OnPause()  { /* stop the coroutines, silence the audio... */ }
    public void OnResume() { /* start again */ }
}

Configure in the inspector the Pause Keys and Resume Keys (two separate lists, so Esc can pause and both Esc and Enter can resume), and wire onPause / onResume to open and close the menu.


How To Use

Mn_PauseManager.Instance.PauseGame();
Mn_PauseManager.Instance.ResumeGame();
bool paused = Mn_PauseManager.Instance.IsPauseGame();

// runs now if the game is running, otherwise at the next resume
Mn_PauseManager.Instance.WaitActionUntilUnpaused(() => SpawnWave());

Good to know:


Testing Scene

Open Debug/PauseScene.unity and press Play: the configured keys pause and resume the game, and Mn_PauseObject logs each notification so you can see the manager reaching the objects in the scene.


Technical Info

Path Content
Scripts/Runtime/Mn_PauseManager.cs The singleton: PauseGame, ResumeGame, IsPauseGame, WaitActionUntilUnpaused, key polling and the two UnityEvents
Scripts/Runtime/IPausable.cs The interface: OnPause and OnResume
Scripts/Runtime/Animation/Mn_PauseAnimator.cs Base for animations that must keep playing while paused
Scripts/Editor/Mn_PauseManager_Editor.cs Inspector with the live state and the pause/resume buttons
Prefabs/PauseManager.prefab The ready-made manager
Debug/Mn_PauseObject.cs, Debug/PauseScene.unity Sample pausable and test scene

© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 3 modules in total.