Search Unity

Unity UI What does "Navigation = None" do to InputFields? (Bug?)

Discussion in 'UGUI & TextMesh Pro' started by SimRuJ, Oct 16, 2018.

  1. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    Setting a button's navigation to "None" makes it unreachable to gamepads and also makes it lose focus if you hover over a different button - instead of staying highlighted like it does with the navigation set to "Automatic".

    But what does "None" do to an InputField? If I create two InputFields, set both of their navigations to "None", click on the first and then hover over the second, both of them are highlighted until I click on the second (which resets the first's color to back to "normal").

    I'm using Unity 2017.3.1f1. Is this a bug?
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    None == none. That means you're hadling the navigation on your own, e.g. with a custom script.
     
  3. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    @VergilUa That's what I guessed at first but shouldn't it act like a button then?

    2 Buttons with navigation set to "None":
    - Click on the first, it quickly switches to the "pressed" state, then stays on "highlighted"
    - Hover over the second button -> the first goes back to "Normal" and the second switches to "highlighted"
    - On "Automatic" the first button would still be on "highlighted" until you actually click on the second

    2 InputFields with navigation set to "None":
    - Click on the first, it quickly switches to the "pressed" state, then stays on "highlighted"
    - Hover over the second InputField -> the first is still on "highlighted" and doesn't switch to "Normal", even though the second is now on "highlighted" too

    This is the same behavior buttons on "Automatic" have, so there's no difference in the highlighting for InputFields. The problem is that you can't fix it with code this time because if you do

    EventSystem.current.SetSelectedGameObject(null);


    with InputFields, they lose focus, which means that you also can't type in them anymore and I haven't found a way yet to call this when you stop hovering over one (there's only "isFocused", which means "is clicked and ready to type something in it").