Sent to all game objects when the player pauses.
var paused: boolean; function OnGUI() { // Show a message if the game is paused. if (paused) { GUI.Label(new Rect(100, 100, 50, 30), "Game paused"); } } function OnApplicationPause(pauseStatus: boolean) { paused = pauseStatus; }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { public bool paused; void OnGUI() { if (paused) GUI.Label(new Rect(100, 100, 50, 30), "Game paused"); } void OnApplicationPause(bool pauseStatus) { paused = pauseStatus; } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): public paused as bool def OnGUI() as void: if paused: GUI.Label(Rect(100, 100, 50, 30), 'Game paused') def OnApplicationPause(pauseStatus as bool) as void: paused = pauseStatus