In my PlayerBehavior.cs file
void Update ()
{
if (Input.inputString.Length>0){
Debug.Log ("Pressed =" + Input.inputString);
}
if (Input.GetKeyDown ("p")) //from Up
{
PauseMenu.isPaused=!PauseMenu.isPaused;
}
}
PauseMenu.cs is as follows:
using UnityEngine;
using System.Collections;
public class PauseMenu : MonoBehaviour {
public static bool isPaused;
public float windowWidth= 256;
public float windowHeight = 100;
public GUISkin newSkin;
enum Menu{None, Pause, Options};
private Menu currentMenu;
// Use this for initialization
void Start () {
isPaused = false;
currentMenu = Menu.None;
}
void OnGUI() {
GUI.skin = newSkin;
Debug.Log ("Inside OnGUI");
if(isPaused && currentMenu == Menu.None)
{
currentMenu = Menu.Pause;
Debug.Log ("Inside isPaused && currentMenu == Menu.None");
}
if(currentMenu == Menu.None)
{
Time.timeScale = 1.0f;
Debug.Log ("Inside currentMenu == Menu.None");
return;
}
Time.timeScale = 0.0f;
switch (currentMenu)
{
case Menu.Options:
Debug.Log ("Inside before ShowOptionsMenu");
ShowOptionsMenu();
break;
case Menu.Pause:
Debug.Log ("Inside before ShowPauseMenu");
ShowPauseMenu();
break;
}
}
Looks like inside OnGUI() function on PauseMenu.cs IsPause=false to cause Menu.Options never to be true from Main_Menu scene that includes PlayerBehavior.cs script. Any idea what is causing this?