- Home /
Question by
caden947 · Dec 05, 2016 at 07:30 AM ·
unity5not workingcursortimescalemenu screen
Rest of project ignoring script
For reasons unknown to me, my menu managing script is seeming to have no effect on my game aside from enabling and disabling the menu and the crosshair. For example, when it's supposed to change the timescale, nothing happens within the game or scene spaces. I tried using Debug.Log and according to the log, the timescale did change, but as stated before, the game wasn't effected.
This appears to be the only script to not work properly.
Any help with the matter would be appreciated.
EDIT: And yes, I have tried to create a standalone build. Same problem.
Menu script using UnityEngine; using System.Collections;
public class MenuManager : MonoBehaviour {
public GameObject menu;
public GameObject player;
public GameObject crosshair;
public bool isOpen = false;
CharacterControllaer c;
void Start()
{
c = player.GetComponent<CharacterControllaer> ();
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.Escape))
if(isOpen == false)
{
c.isPaused = true;
isOpen = true;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
menu.transform.GetChild (0).gameObject.SetActive (true);
crosshair.transform.GetChild (0).gameObject.SetActive (false);
Time.timeScale = 0;
}
else
{
c.isPaused = false;
isOpen = false;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
menu.transform.GetChild (0).gameObject.SetActive (false);
crosshair.transform.GetChild (0).gameObject.SetActive (true);
Time.timeScale = 1;
}
}
}
Comment