Question by
braydon97 · Jul 19, 2016 at 02:32 AM ·
c#unity5pause menuoptionsmenu screen
When I open my Ingame Menu My mouse appears Then when I click it disappears
When I press escape in my game the Mouse cursor appears but once I click in the menu it disappears Now this is a problem because I have "options" in there that you can change. but The mouse cursor disappears so you cant click on any of them. any help would be nice! My code:
using UnityEngine; using UnityEngine.UI; using System.Collections;
public class OptionsScript : MonoBehaviour {
public Canvas IngameOption;
public bool menuEnabled = false;
public bool pause = false;
// Use this for initialization void Start() {
IngameOption = IngameOption.GetComponent<Canvas>();
menuEnabled = false;
IngameOption.enabled = menuEnabled;
}
void Pause()
{
pause = !pause;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown("escape")) {
menuEnabled = !menuEnabled;
IngameOption.enabled = menuEnabled;
Pause();
}
}
}
Comment
So, where is the code for handling menu clicks? Do you set Cursor.visible = false anywhere in your code?