Driving myself mad again going around in circles, trying to move onto to something else but can't until I sort this! When I open the pause menu the player can still interact with other menus that may have been opened before the pause menu was opened.
This obviously is not ideal, I've tried various methods but nothing has helped. I must explain that my game can be controlled in two ways, either Mouse or Keyboard/Controller. If in mouse then all the menus are navigated by the mouse and the issue I encounter is easily avoidable as I inserted a a panel that fills the screen so that it blocks all raycasts and prevents the player from clicking beyond the pause menu.
My problem comes from when the player is controlling with a Keyboard or Controller, whilst in this control scheme I set all the first selected elements via a custom script to allow for direct navigation of the menus (this works perfectly with no issues) however if I, for example, open the Inventory first and then the pause menu the element of the Inventory is still selected and so not only can the player not get to the pause menu (unless obviously using the mouse) they are also able to click on the Inventory icons.
Quick example is below, you can see that I have opened the pause menu after the Inventory however the shift left button of the inventory is still highlighted and selected and the player is stuck on this menu whilst in Keyboard/Controller method.
I tried running custom scripts however for some reason I can't seem to get what I want working, I have tried going down the route of setting the selected game object of the current event system via the following - EventSystem.current.SetSelectedGameObject (myButton);
The myButton variable is set correctly to the gameobject I want however it doesn't change. I've also set up a custom script that shows what the current selected game object is at any time and this updates correctly when I open a menu on it's own as AC sets the FirstSelectedElement correctly and updates the event manager however nothing changes when I open a second menu with the first still being active and open.
Any advice? Or do I need to close all menus whenever I open a second menu? Seems taxing particular considering I don't see a universal close all menus option in the action lists and would have to close each one (and then even more taxing would be to find out which were open originally so that I correctly turn back on the correct ones once I exit the new menu.
Any help would be greatly appreciated, either with setting the first selected game object or even a better alternative that I'm missing entirely. Thanks in advance.
Comments
When the Input method is set to Keyboard Or Controller, AC has a built-in way of blocking mouse-clicks - so there's no need to have a raycast-blocking panel. This is provided, however, that no custom EventSystem is used - and that Disable mouse when keyboard-controlling Unity UI Menus? is checked in the Menu Manager.
What is the Appear type of the Inventory menu, and does it also pause the game? It shouldn't be that this occurs in a keyboard/controller-only game, so the first thing will be to get it working correctly (or confirm that it's a problem), without any custom scripts that alter settings based on input.
I would recommend trying to get the desired behaviour in a separate game (you can use the NGW to create more Managers in the same project, and then share the same Menu Manager), but fixing it at Keyboard Or Controller input.
I may have recreated the issue. If your Inventory menu doesn't pause the game, are you using the Engine: Manage systems Action to allow in-game control?
Regarding the non-pausing Pause menu: while I'll try to address the original problem, you can still make use of a Pause menu that doesn't actually pause the game by again using the Engine: Manage systems to disable regular interaction and movement. An additional Character: Move along path Action may also be necessary to command the player to stop moving.
The ordering of Menus has an impact on a few things, such as display order when drawn with AC. But with Unity UI, the bottom-most Menu takes direct-control priority over ones above it, which is why the Inventory menu retains control even when Pause is enabled.
To fix this, move your Pause menu below your Inventory (or vice-versa). There is, however, a true bug in that when Pause is disabled, the Inventory menu won't re-enable. This shall be addressed, along with a few other bugs related to the "Auto-select first element" option, in the next update.