Pause Menu not showing
So, I made a Pause Menu with a free pack (so it's in a canvas) and now I'm trying to make it so when I press ESC key the Menu shows, but it just doesn't...
I wrote a code (which is probably wrong) like this: [Serialize] private GameObject PauseMenu;
void Start () { PauseMenu.SetActive(false); }
void Update() { if(Input.GetKeyDown(KeyCode.Escape)) { PauseMenu.SetActive(true); } }
But it just doesn't seem to work (although the console reports no error).
Can someone please tell me where I'm wrong and what I have to do to make my Pause Menu (which I recall is in a canvas so no GUI please) show?
Answer by romatallinn · Nov 21, 2016 at 11:04 PM
The code is mostly correct, but:
[SerializeField], but not [Serialize]
I am confused, because console was to throw an error. Moreover, how did you assign the variable PauseMenu in this case? Did you actually assign the variable PauseMenu?
Your answer
![](https://koobas.hobune.stream/wayback/20220612101129im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
rpc not working 0 Answers
GameObject.Destroy(gameObject); Not Working? 0 Answers
Why wont the target be destroyed? 0 Answers
Pause menu not working!! 1 Answer
Destroying prefabs breaking scripting for other prefabs 0 Answers