how to pause time unity code example
Example 1: how to pause your game unity
using UnityEngine;
void Pause()
{
Time.timeScale = 0;
}
void Unpause()
{
Time.timeScale = 1;
}
Example 2: wait time in unity
using System.Collections;
private void Start()
{
StartCoroutine(Wait());
}
IEnumerator Wait()
{
yield return new WaitForSeconds();
}
Example 3: how to pause physics in unity c#
Physics.autoSimulation = false;
Example 4: pause unity game
void PauseGame ()
{
Time.timeScale = 0;
}
void ResumeGame ()
{
Time.timeScale = 1;
}Copy