Search Unity

Question Input System UI Input Module - UI Button does not respond to click/hover

Discussion in 'Input System' started by tanayg, Jul 20, 2020.

  1. tanayg

    tanayg

    Joined:
    Jul 20, 2020
    Posts:
    5
    Hi,

    I'm trying to get my button to respond to click/hover events with the new Input System. I have an empty object with a script containing a function which logs a message when called. This function is mapped to onClick() of a UI button.

    My empty object also contains the Input System UI Input Module component, along with an Event System component which gets automatically added with it.

    Images showing my setup are attached:

    upload_2020-7-20_22-39-22.png upload_2020-7-20_22-39-36.png upload_2020-7-20_22-40-5.png
    Any help regarding this is very much appreciated.

    Thanks!
     
    hayone1 and reinfeldx like this.
  2. reinfeldx

    reinfeldx

    Joined:
    Nov 23, 2013
    Posts:
    164
    I'm having the same problem. I've been searching for hours and trying all the usual interactable-UI debugging, but I'm starting to think it's the New Input System that's the problem. I have another separate project that uses the old input system and it's working fine.

    Did you come up with a fix for this?
     
    hayone1 likes this.
  3. tanayg

    tanayg

    Joined:
    Jul 20, 2020
    Posts:
    5
    I haven't found anything to solve this yet, so I have had to set this aside unfortunately.
    I was hoping to get this noticed by @Rene-Damm for the proper solution.
     
    hayone1 and reinfeldx like this.
  4. reinfeldx

    reinfeldx

    Joined:
    Nov 23, 2013
    Posts:
    164
    Same. I was looking forward to using the new input system, but I've had to pivot to an alternative :/
     
    hayone1 likes this.
  5. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Sorry for the long delay. In general, any kind of "works with StandaloneInputModule but no longer works with InputSystemUIInputModule" is with almost 100% certainty a bug. Please file a ticket with the Unity bug reporter ("Help >> Report a Bug..." in the editor's main menu) so we can have a look.

    For debugging, first step I would recommend is popping open the input debugger ("Window >> Analyze >> Input Debugger") and while in play mode and everything set up, checking if all the respective actions are enabled and bound to the right kind of things.
     
    hayone1 likes this.
  6. piggybank1974

    piggybank1974

    Joined:
    Dec 15, 2015
    Posts:
    621
    If I'm correct I'm using the EventSystems, as long as you set it too the first control you want active it will work

    EventSystem.current.SetSelectedGameObject(null);
    EventSystem.current.SetSelectedGameObject(YourGameObject);

    Also, note that for each button you will need to change the navigation up/right/down/left to the gameobject you want ti to go to.
     
  7. DSivtsov

    DSivtsov

    Joined:
    Feb 20, 2019
    Posts:
    151
  8. wujinjindx

    wujinjindx

    Joined:
    Feb 9, 2020
    Posts:
    3
    Just to help any more people who encounter this annoying issue.

    Other than the general configurations of EventSystem and Canvas, there is another cause of the irresponsive UI buttons I figured out in my own programs and I think it may be the cause for most people.

    The issue occurs when you add a camera by yourself (very common) without tagging it as MainCamera. If you have no clue of tagging it, then it is very likely to be your cause.

    key point: The camera you use with standalone input module must be tagged as MainCamera. Otherwise it won't recognise objects with no collider.