I have two scenes: menuscene and scene1
Play button of menuscene is working well. It loads scene1 but when I press escape then nothing happen even debug.log is also not working.
Code of my menuscene is as:
using UnityEngine;
using System.Collections;
public class MenuScript : MonoBehaviour {
// Use this for initialization
public Canvas PauseMenu;
public bool isPaused;
public KeyCode PauseKey;
void start()
{
PauseMenu.enabled = false;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape)) {
Debug.Log("Escape is pressed");
if(!isPaused)
{
Paused();
}
else
{
Unpause();
}
}
}
void Paused()
{
Debug.Log("yes it is paused");
PauseMenu.enabled = true;
isPaused = true;
Time.timeScale = 0f;
}
void Unpause()
{
PauseMenu.enabled = false;
isPaused = false;
Time.timeScale = 1f;
Application.LoadLevel ("Scene1");
}
public void ChangeScene(){
Application.LoadLevel ("scene1");
}
public void ExitGame(){
Application.Quit ();
}
}
What is wrong?
Thanks