I created an Action of Type Button that uses a Binding of Left Button [Mouse], while running the game when I click the left mouse button it does not call the associated function. As a test I added a Gamepad button and it called the function as expected. (don’t think its script related)
I have an Input System UI Input Model (Script) assigned to a game object.
I have an Event System added as well.
In the Input Debugger I see that it registers the mouse clicks.
Your event system makes use of the left click so you either need to check it another way like “Mouse.current.leftButton.wasPressedThisFrame” or maybe you can edit the eventsystem parameters.
Hi there, what I did in my case is to open the “Input Action” asset and in your control schemes, select the keyboard scheme you created and edit it to add a Mouse control. Like this:
FOUND IT!
If for you too well the InputManager is not accepting the inputs from the mouse and or not detecting its being used used (ie Control Schemes to know when a KBN or gamepad is used).
Then ensure that in your “Kb and mouse” scheme the Mouse is first in the list.
Unity Version : 2021.3.5f1
Thank you, so much. I was about to pull out significant chunks of hair because I could not figure out why mouse events where not picked up. This solved it.
In case anyone is having the same issue as me:
I was trying to use the built in “Click” action in the UI action map (from the provided “InputSystem_Actions” asset), and subscribe to the “started” callback. However, because the “Click” action in the UI action map is set up as a “Pass Through” rather than “Button” action type, the “started” callback is not used (see here for more: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.14/manual/Interactions.html#default-interaction)
I could instead subscribe to the “performed” callback, but this will be called both on mouse click and release, which was not the behavior I wanted. So I instead created a new action, bound to the left mouse button, and with the “button” action type.