pause unity from script code example
Example 1: how to pause your game unity
using UnityEngine;
void Pause()
{
Time.timeScale = 0;
}
void Unpause()
{
Time.timeScale = 1;
}
Example 2: pause unity game
void PauseGame ()
{
Time.timeScale = 0;
}
void ResumeGame ()
{
Time.timeScale = 1;
}Copy