0
\$\begingroup\$

I'm quite new to Unity but I'm making a game, and have created a simple Pause menu, when a key is pressed (escape), I just load a Pause scene, additively, and set that Pause scene to the active scene, however, only the buttons on the previous 'game' scene are interactive. The mouseEnter, exit etc aren't triggering on the pause menu buttons, despite the pause menu being overlayed on top of the 'game' scene; the Pause scene being the active one and the 'game' scene buttons are still the interactive ones (i.e. register clicks, mouse overs etc).

Obviously when I open the pause menu, I want the pause menu buttons to be the interactive ones (registering clicks, mouse over etc), not the previous 'game' scene buttons.

The pause menu scene interacts perfectly when loaded additively with a scene that had no buttons.

Many thanks.

\$\endgroup\$
  • \$\begingroup\$ Does your Pause Menu scene contain its own Event System that is getting eclipsed by the one in the previous scene? \$\endgroup\$ – DMGregory Sep 6 at 14:36
  • \$\begingroup\$ Yes, actually I believe that's exactly what is happening. Can I just disable the event system on the game object, or would I need to disable the individual components? \$\endgroup\$ – SamuraiMelon Sep 6 at 14:40
  • \$\begingroup\$ Sounds like a good thing to test! What do you find when you try different disabling strategies? \$\endgroup\$ – DMGregory Sep 6 at 14:56
  • \$\begingroup\$ Well, the current event system can easily be disabled with EventManager.current.enabled = false, and then to enable it I need to use FindObjectOfType<EventManager>.enabled = true. However, I'm still not getting the intended behaviour i.e. mouse events still aren't registered in the Pause scene \$\endgroup\$ – SamuraiMelon Sep 6 at 15:06
1
\$\begingroup\$

Solution was the edit the Canvas 'Order in Layer' option, with the pause menu having a higher order. Presumably this means the pause menu UI, is now properly layered over the top of the game scene UI, and so the mouse corrects hovers over the pause menu buttons, not the game buttons.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.