Mouse Issues
Whenever I hit Escape I get my pause menu, but my mouse is hidden behind my menu. I hit Escape again and my mouse is present. I hit Escape one last time to have the mouse on my menu. I do not know the scrip to make the mouse ONLY visible when the menu is up. Any help would be great. Here is my current Pause Menu Script:
using UnityEngine; using System.Collections; using UnityStandardAssets.Characters.FirstPerson; public class PauseGame : MonoBehaviour { public Transform canvas; public Transform Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update() {
if (Input.GetKeyDown(KeyCode.Escape))
{
Pause();
}
}
public void Pause()
{
if (canvas.gameObject.activeInHierarchy == false)
{
canvas.gameObject.SetActive(true);
Time.timeScale = .15f;
Player.GetComponent<FirstPersonController>().enabled = false;
}
else
{
canvas.gameObject.SetActive(false);
Time.timeScale = 1;
Player.GetComponent<FirstPersonController>().enabled = true;
}
}
}
$$anonymous$$aybe try using .SetActive() ins$$anonymous$$d of .enabled?
Answer by Gingernator_X · Nov 10, 2016 at 08:05 PM
Just bumping this since I have not gotten any answer yet :)
Your answer
Follow this Question
Related Questions
how to make camera move with the mouse cursors 6 Answers
How to make my flashlight move with the mouse movement? 0 Answers
What is wrong with this simple code? 1 Answer
[C#]detect object on mouse look? 1 Answer
How can I create this particle effect 0 Answers