First of all my english is bad so sorry my mistakes writting. I’m trying to make work a pause menu which use canvas and timescale works, but if I press the movement keycodes the object still moving so i decided if the timescale = 0 disable the scrip of the object but i had a lot of issues and i can’t find a solution so anyone could help me? this is my pause script:
public class pause : MonoBehaviour {
public Transform canvas;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown (KeyCode.Escape))
{
if (canvas.gameObject.activeInHierarchy == false) {
canvas.gameObject.SetActive (true);
Time.timeScale = 0;
if (canvas.gameObject.SetActive (true))
{
GetComponent<Group> ().enabled =(false);
}
}
}
}
public void Return()
{
canvas.gameObject.SetActive (false);
Time.timeScale = 1;
if (canvas.gameObject.SetActive (false))
{
GetComponent<Group> ().enabled =(true);
}
}
public void Exit()
{
SceneManager.LoadScene ("MainMenu");
}