Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feedback Player Input - Input System UI Input Module setup tips

Discussion in 'Input System' started by Livealot, Apr 1, 2021.

  1. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    Configuring this correctly could use some more explanation somewhere. Sharing my experience in case it helps others. I'm using v1.1.0-preview 3

    I was struggling with switching action maps as I was completely losing mouse input when I switched to a specific action map.

    When setting up a Player Input component, there's a "Fix" button to connect the Input Action Asset to the Input System UI Input Module. Behind the scenes, this replaces the default UI settings (UI / Click) with whichever action map is first alphabetically (aaUI / LeftClick).

    UIInputModule.JPG

    If you ever switch to that action map in-game, there's a conflict between the Player Input and the Input System UI Input Module since both are trying to do something with the same input, e.g., mouseclick.

    So it seems like a stable setup requires creating an Action Map that is DEDICATED to populating the Input System UI Input Module. And you can either name that Action Map so that its first alphabetically and use the "Fix" button, or you can manually assign it in the Inspector for the Input System UI Input Module for each action.

    Once correctly assigned, it's important NOT to ever switch to that Action Map in the game to avoid conflicts.
     
  2. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    I went back to look at the Warriors example project and the similar setup does NOT have the conflict I see in my project when switching Action Maps. Also interesting that the Warriors Player Input component does not connect to the Input System UI Input Module.

    So, I'm looking for other differences that might cause my project to lose mouse input when switching to the same Action Map that is assigned to the events in the Input System UI Input Module.

    First, in my project, my inventory UI is in a side panel next to my gameplay panel. That creates situations where gamepad stick movement could control the character on the gameplay screen and simultaneously navigate UI choices in the UI screen. This is a different issue than losing input, and hopefully can be solved by finding the right way to disable the UI module while using the Player action map.

    Another difference is that I have gameplay objects (gridcells on a gameboard) that use things like
    IPointerClickHandler to capture mouse input. I assume this is also routed through the Input System UI Input Module although it's not technically "UI". So maybe I get a conflict because I have two things fighting over the same input (a UI panel and a gameobject) whereas the example project does not get a conflict since it only has one thing (the UI panel).
     
  3. Ca2didi

    Ca2didi

    Joined:
    Sep 8, 2019
    Posts:
    8
    I've got a same issue like you...But there is a wired thing is that switching action map in PlayerInput will do no affection to Input Module at first, but it goes wrong later even if it would work before.No matter I replay game for many time, it could not working correctly again.