Hey! I’m currently trying to make a pause menu, and I’m making the menu the same way I made my main menu & options menu, but inside of the game scene, rather than having its own scene, since its a pause menu.
My main menu works fine, but when I pause in my pause menu, when you hover over a button, the button doesn’t highlight, when you click a button, nothing happens, and it locks your cursor in the center as if the character controller was trying to take control of the mouse. I’ve even went as far as disabling the character controller when you pause, changed nothing, so that’s not the problem…
It can happen because the menu is probably coming in between the button. So the button might not be receiving any mouse input. Try making the menu smaller in size and showing itself on one corner only. And check again.
Wait, so what exactly should I do? Sorry, I don’t really understand… What does the menu coming between the button mean, and what do you mean but show itself on one corner only?
Oh boy, we can only really stumble in the dark here and take your word, that you’ve set up everything correctly, for granted.
Obviously if your button doesn’t work, it has to be one of the two things:
you didn’t follow the protocol, and your button doesn’t receive any cues from your input
you did everything right, but something else is interfering with your input, with the same result as 1
Now why does that happen? ¯_(ツ)_/¯
You need to debug, to analyze what’s going on, try some things step by step, and try and deduce what might be the underlying cause. Do some tests, give us more hints what works and what doesn’t. Try to reproduce this in another project, when you’re not using some other scripts, packages, whatnot. Debug debug debug.
What Vishwas told you is a common issue, from his experience at least, where what you’re seeing and what you’re interacting with aren’t necessarily the same things, and could be differently positioned in relation to camera. So even though you might see your button, it doesn’t mean it will behave properly. Maybe some other collider is occluding it, preventing any mouse hits.
I think the screen that says “Paused” - “Back to Game Menu” is coming in between when you try to click the button behind it. So what you are interacting with is not the button, but probably the menu. Just a guess though.
hey everyone. I have had the same problem with the UI buttons on my pause menu. In my case the solution was to spend another 10 hours solving it with turning another object off which technically has nothing to do with the buttons. I suspected that (after checking all setting and code etc that I haven’t even touched since the beginning when the button were still working) something is front of the buttons hence it cant be clicked. Well…yes and no… It was the “End game fade canvas” that was blocking the stuff. I had to turn it off although when the player dies or wins the fading canvas still works… Nut sure what is going on but I suspect that maybe the event system turns it back on but otherwise when the game starts it has to be turned off???
I’m having the same problem, I found that (Cursor.lockState = CursorLockMode.Locked) is what have been causing that to happen, so there should be an alternative code that locks and hides cursor during the game, and interacts with buttons when the game is paused
I had similar problem but my pause menu worked in the first scene, but didn’t work in the second. It was strange to me why it was happening as I copied and pasted the whole canvas. I tried to create another canvas to see if it is going to work. And as I created the new canvas the EventSystem was also created. Then I dropped my canvas in EventSystem and it worked. Such small and stupid mistake. But well always something new to learn.
It was the same for me, the “Fade Screen” (or whatever you named it). The fade canvas object needs to be in the Hierarchy somewhere over the “Pause Menu”.