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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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.