UI Navigation with controller/keyboard not working

tippington

New member
I'm working on a project where a player will approach a crafting bench and press the Interact button/key to bring up the bench's crafting menu.

That's working, and the crafting menu appears as expected, but once it's visible, controller or keyboard input doesn't work for navigating it or selecting any of the buttons on it. The buttons are clickable with the mouse, but that's all.

I don't want the player to be able to move, jump, etc when the crafting menu is open, so I put this code in the Open method for the menu. There's also some logic to select the first cell of the menu (which contains a Button):

Code:
        // Disable player input
        EventHandler.ExecuteEvent(PlayerBehavior.Character, "OnEnableGameplayInput", false);

        // Auto-highlight first cell
        if (activeCells.Count == 0) { return; }
        EventSystem.current.SetSelectedGameObject(null);
        EventSystem.current.SetSelectedGameObject(activeCells[0].gameObject);

Of course, when the menu is closed, the player needs to be able to move again, so I put this code in the Close method for the menu:

Code:
        // Enable player input
        EventHandler.ExecuteEvent(PlayerBehavior.Character, "OnEnableGameplayInput", true);

This project is using Rewired for controller integration, but I don't think that's the problem since keyboard UI navigation isn't working either. What am I missing here that is preventing this from working?

Thanks in advance for your help.
 
I'm not sure what is going on, but I don't think that it is related to the character controller. The character controller doesn't manage the EventSystem so even if the character has the gameplay input enabled the EventSystem should still respond.
 
Top