Mouse turns invisible when you return to the main menu or help menu
So I have 3 scenes that trigger this glitch, the Main Menu, the Help Room and the Play Area.
What happens is, if I go from the Main Menu to the Play Area or Help Room, it runs fine but if I go from the Play Area to either the main menu or Help Room, it turns the cursor/mouse invisible. This might help explain it better:
Main Menu -> Play Area Mouse is visible.
Main Menu -> Help Room -> Play Area Mouse is visible.
Play Area -> Main Menu Mouse is invisible.
Play Area -> Help Room Mouse is invisible.
Play Area -> Help Room ->Main Menu Mouse is invisible.
This is what my script looks like for the pause menu/UIManager:
public class UIManager : MonoBehaviour { private GameObject[] PauseMenu;
// Use this for initialization
void Start()
{
Time.timeScale = 1;
PauseMenu = GameObject.FindGameObjectsWithTag("ShowOnPause");
hidePaused();
}
// Update is called once per frame
void Update()
{
//uses the Esc button to pause and unpause the game
if (Input.GetKeyDown(KeyCode.Escape))
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
showPaused();
}
else if (Time.timeScale == 0)
{
Debug.Log("high");
Time.timeScale = 1;
hidePaused();
}
}
}
//Reloads the Level
public void Reload()
{
Application.LoadLevel(Application.loadedLevel);
}
//controls the pausing of the scene
public void pauseControl()
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
showPaused();
}
else if (Time.timeScale == 0)
{
Time.timeScale = 1;
hidePaused();
}
}
//shows objects with ShowOnPause tag
public void showPaused()
{
foreach (GameObject g in PauseMenu)
{
g.SetActive(true);
}
}
//hides objects with ShowOnPause tag
public void hidePaused()
{
foreach (GameObject g in PauseMenu)
{
g.SetActive(false);
}
}
//loads inputted level
public void LoadLevel(string level)
{
Application.LoadLevel(level);
}
//exits game
public void doExitGame()
{
Application.Quit();
}
}
Another thing I would like to add is that when the pause menu is active, the camera still follows the mouse and so far I haven't found a way to fix that either but right now I'm more concerned about this glitch since I want the cursor/mouse to be visible.