I’m trying to add the new Input System to my existing game; in my scene I have a GameObject with multiple UI Documents which share a ‘PanelSettings Asset’ in which I’m setting the ‘Display’ to either ‘Flex/none’ to show hide each window and some buttons to navigate between.
After adding the Input System from the Package Manager and enabling the ‘Active Input Handling’ in the Project Settings>Player as the new Input System, my UI now doesn’t react to any Hover or Click actions as they used to. My understanding from reading the docs (Unity - Manual: Runtime UI event system) is that I should only need to add a ‘UI > Event System’ and add an ‘Input System UI Input Module’ in order to receive events as previously but this isn’t working.
I have also made sure to add a ‘.Focus()’ call to the container of the first window whenever it is shown. I am also still using the ‘DefaultInputActions’ on the Input System UI Input Module before trying to get my own player controls working, the Event System has no Game Object for its ‘First Selected’ field.
Do I need to add a Player Input component to my UI Documents and map each button click event? How would this work for hover events?
Edit: Forgot to mention this is with Unity 2023.2.17f1
Edit1: I can interact with my buttons using the Input Debugger if I manually select ‘Enable Device’ on the Mouse, is there any reason I would have to do this manually?
You menioned you have multiple UI documents. Do they have non-visible elements that overlap? If so, it’s possible that a document with a higher sorting order value is stealing your mouse hovers from underlying documents, especially if that document contains transparent “pickable” visual elements that overlap with underlying visual elements from other UI documents. Check your visual element “pickable” settings and make sure the transparent ones using screen space are marked as “ignore”.
Also, which version of the InputSystem package are you using? If you’re using 1.8 or above, you should probably be using the project-wide input actions setting. Then, as long as you have an action map called “UI” with the standard “Point” and “Click” actions, your UI Toolkit elements will receive mouse hover events even without setting up EventSystem or InputSystemUIInputModule components.
Another thing to try is opening the Input Debugger window while your application is running. Then check to see which input actions are active at any given time. You should see the “UI/Click” and “UI/Point” actions if they are enabled.
Hi Beevik! Thanks for taking the time to respond! So I eventually discovered on another forum post that by having the ‘Simulator’ window open, all Mouse events are redirected to that instead, even though I had it behind my Scene/ Game views, would’ve been handy for Unity to provide a message but glad that it was an easy fix.
In regards to your comment about the project-wide input actions and the ‘UI’ map, I’m having another issue you may be able to help with? If I’m interpreting the docs correctly the “Input System UI Input Module” should provide some out-of-the-box functionality in regards to input with Mouse & Keyboard events.
Although I’m now able to receive Mouse events I’m having issues pickup up any sort of “Navigation” events, I’ve duplicated the entire ‘UI’ Action Map from the default action map to my own and even when manually switching to this action map I’m unable to navigate between any of my on-screen UI buttons using the keyboard.
I noticed the default action map uses a ‘Navigate’ action with callbacks to navigate events:
Are we expected to implement these callbacks to handle UI navigation? If so, how would one access the available focusable elements and choose which to navigate to on move?
I’m currently using v1.8.1 of the Input System with the UI Toolkit, thanks again!