Okay, so I want to be able to pause and unpause my game (not using a GUI text, but instead by just pressing P) and here is my coding so far…
using UnityEngine;
using System.Collections;
public class Pause : MonoBehaviour {
public bool paused = false;
void Start ()
{
paused = false;
Time.timeScale = .1f;
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown ("p") && paused == false)
{
Time.timeScale = 0;
paused = true;
}
if (Input.GetKeyDown ("p") && paused == true)
{
Time.timeScale = 1;
paused = false;
}
}
}
btw it’s in C#. It won’t pause but when I hit the P button it goes from Time.timeScale = .1f; to Time.timeScale = 1;
How do I fix that (relativley new to this and I can’t find the answer anywhere, trust me.)