Search Unity

Resolved About the new input system UI module...

Discussion in 'Input System' started by aomikki, May 31, 2022.

  1. aomikki

    aomikki

    Joined:
    Mar 26, 2018
    Posts:
    7
    So... I get bunch of tutorials about the basic character controls and player input. So far it's all great and understandable, at least what I could get.
    Then, I started to proceed to the UI.
    extra input.PNG
    As shown in the image, I was trying to add a keyboard bindings, my actual intention is to be the same as "Player/Fire" actions. At the moment, I didn't make any extra script regarding the UI input as I could navigate the UI normally and press enter for submit, yet I can't submit with the assigned keyboard key (the "F" button).

    How do I handle this? I tried changing the UI Input Module Submit from "UI/Submit" to "Player/Fire" but this just makes it more unusable. Perhaps I should change the assignment in "Submit [any]", but I have no idea how to change or add something to it.

    Additionally, how do I detect the UI move navigation input? I want to use this to focus into a button when the event system doesn't have any selected object.

    Thank you in advance.
     
  2. sunsi12138

    sunsi12138

    Joined:
    Apr 14, 2020
    Posts:
    23
    According to my limit experience,if you are using PlayerInput to manage input , you have to Change Action Map to "UI" using SwitchCurrentActionMap()

    if you want to navigate to some object when no object selected, I recommond to listen on Navigate action, and predicate whether Eventsystem has currentSeleted object, if not ,use SetSelectedGameObject to whatever you want
     
  3. aomikki

    aomikki

    Joined:
    Mar 26, 2018
    Posts:
    7
    Thank you for your second advice, I haven't used that before in script so it's new for me.

    As for the first one, I double checked and figured it out that the Input Module has default action assets setup so it's now fixed after changing it to my action assets.