Pause and multiplayer hooks
Choose the Pause Mode on the front end (the MenuRoot component):
| Mode | What happens | Use it for |
|---|---|---|
| Freeze | Time.timeScale = 0 and (optionally) AudioListener.pause, both restored exactly on resume; the input lock is raised. |
Single-player games |
| Overlay Only | The pause menu shows over the running game; time doesn't stop; the input lock is raised. | Multiplayer and online games, where time can't stop |
| Custom | Only the onPaused / onResumed events; your game decides everything. |
Your own pause logic |
Input lock #
While a menu should block gameplay input, MenuRoot.InputLocked is true and MenuRoot.InputLockChanged (static event) and onInputLockChanged (UnityEvent) fire. Disable your player input there:
void OnEnable() => MenuRoot.InputLockChanged += OnLock;
void OnDisable() => MenuRoot.InputLockChanged -= OnLock;
void OnLock(bool locked) => playerInput.enabled = !locked;
Events #
onNewGame, onContinue, onLoadGame, onMainMenuRequested, onQuitRequested, onPaused, onResumed, onLoadCompleted, onInputLockChanged: all UnityEvents on the front end.
Multiplayer notes #
- Settings are local to each player's machine (one settings file per user); nothing goes over the network.
- Use Overlay Only (or Custom) so pausing never stops a networked simulation.
- Pause On Controller Disconnect can be turned off for online games.