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

Button UI Not Working with The new Input system

Discussion in 'Input System' started by suiksuiky, Dec 22, 2019.

  1. Nianyi_Wang

    Nianyi_Wang

    Joined:
    Sep 9, 2021
    Posts:
    17
    Yes. Sorry for the late reply. The solution is to upgrade the IS package to the latest version. There seems to be a bug in the earlier version.
     
  2. Galaxyben

    Galaxyben

    Joined:
    Jul 19, 2017
    Posts:
    5
    This worked for me as well.
     
  3. chrisjfarr

    chrisjfarr

    Joined:
    Feb 17, 2018
    Posts:
    4
    The fact that this thread is two pages long with a dozen or so suggestions to fix this problem...makes me want to vomit when thinking about using this new Input System. I tried a few of these in the PlayGround.scene with just a simple Button added. Nothing changed, same behaviour. Cursor disappears when I click the Button, and the action is not invoked. No thanks Unity. Please take this garbage back to the drawing board.
     
  4. brianduper

    brianduper

    Joined:
    Nov 12, 2020
    Posts:
    4
    this was my solve. so strange because i have a duplicate scene and the same setup with canvas and inputsystem worked fine. so weird this hidden setting was the trick.
     
  5. DiePflanze

    DiePflanze

    Joined:
    Jul 31, 2019
    Posts:
    4
    Hey people, just wanted to add my solution after struggling for two days :/

    I use UI Toolkit and the new Input System. I also use the First Person Starter Asset. I copied the UI Actions from the DefaultInputActions into the StaterAssets ActionMap. In my case, with the help of this thread, i could get the Buttons to Highlight when i hovered them with the mouse, but no ClickEvent was fired when clicking, even though the buttons showed their clicked state (turning slightly grey when clicked).
    This post showed me a working solution: https://forum.unity.com/threads/reg...orking-after-document-is-reactivated.1255713/
    The problem was that i was enabling/disabling the UIDocument-gameobject for hiding or showing the UI, which seems to break the callback-registration i did in Start() or OnEnable().

    Instead, i did what was suggested in said thread and voilá, it worked. I do not enable/disable the UIDocument anymore, instead, i set its style.display property to DisplayStyle.None for beeing hidden or DisplayStyle.Flex for beeing show. Works like a charm and i questioned my life choices only four times trying to figure this out.
     
  6. Tradecenter77

    Tradecenter77

    Joined:
    Jan 15, 2021
    Posts:
    5
    OMG, after two days of headaches I found my solution. And I do feel kind of dumb about it.
    The Input System was on a fixed update, and my menus pause the game by setting Delta Time to zero. So, all my controls stopped working when I opened menus, but worked when I just launched the game with the menu open (because delta time wasn't set to zero which happens for me when I open a menu).

    Setting the update mode in the project settings to Dynamic update fixed my issue.

    Hope this helps someone.
     
  7. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,973
    I spent the better part of the day trying to figure out why my UI was totally unresponsive.

    I had the EventSystem. I had the Input System UI Input Module. The ISUIM's Actions Asset pointed to my Input Action Asset. All of the little fields like Point, Left Click, Move, etc., all appeared on the Component.

    But @celinedrules post above made me go check the contents of my Input Action Asset. Even though it was directly copied from the Starter Assets pack, I found that NONE of the UI/Whatever events were registered for KeyboardMouse or any other input scheme. Just blank. No checkmarks. Effing useless.

    Seriously, debugging crap like this is a drain of energy and makes me hate the Assets-wagging-the-Dog nature of the Input System all the more.
     
  8. tommyroberts526

    tommyroberts526

    Joined:
    Jan 8, 2022
    Posts:
    1
    This is probably from forever ago but oh my god tysm. This fixed my problem! :D
     
  9. Aida_Mercury

    Aida_Mercury

    Joined:
    Aug 24, 2020
    Posts:
    7
    For a single player, you need to reset the first command in the script -> EventSystem.current.SetSelectedGameObject(null);
    EventSystem.current.SetSelectedGameObject(firstButton);

    For two or more players ->
    we change the Event System component to Myltiplayer Event System, in the script we create the variable public EventSystem _eventSystem;
    and we already refer to it in the script to reset and determine the first menu button. -> _eventSystem.SetSelectedGameObject(null);
    _eventSystem.SetSelectedGameObject(firstButton);
     
    Last edited: Apr 9, 2023
  10. paulgullettMR

    paulgullettMR

    Joined:
    Jun 23, 2019
    Posts:
    13
    Ho ho, I read all of these and this one fixed my confusion.
     
  11. GuiVio

    GuiVio

    Joined:
    Jan 25, 2023
    Posts:
    3
    I had to delete and recreate an EventSystem then click on the "Replace with InputSystemUIInputModule" button again (it was already set up that way early on). Suddenly all the guid references for the UI actions were updated and it now works.

    Maybe at the time of creation it was pointing to the default input actions assets and even though the correct Actions Asset was set it had never updated the guids (just a guess).
     
  12. jjfawkes

    jjfawkes

    Joined:
    May 28, 2013
    Posts:
    12
    In my case I had to change the Actions Asset parameter of "Input System UI Input Module (script)" to the default "DefaultInputActions" asset. Even though my custom actions asset has the same action maps, it does not work with canvas UI.
     
  13. mashermack

    mashermack

    Joined:
    Mar 14, 2019
    Posts:
    4
    Oh dear what a rollercoaster it had been, I am facing this exact problem since I moved my controls to the new input system 3 months ago and abandoned because of this exact issue, I've watched literally hours of videos, read documentation, moved the input system on the canvas, on a separate object, on the player object and I literally tried every single damned solution in this godforsaken thread with no resolution.

    So, in despair I have literally started a new project, empty scene, no packages imported apart the new input system from Unity and switched to the new system on the project settings.

    Afterwards I have created a simple basic joystick, UI -> image, no sprites, no frills and attached the On-Screen Stick script that comes with the Input package.
    Doesn't work either, however I popped on the EventSystem object to find the old Standalone input with a message box that says to replace that with the new Input System UI - I click yes, replace it and so be it, I noticed it asked for the Action Assets to match the Input Action and I linked it as it asked, hold and behold, this one works.

    Now, I opened the two projects side by side and started comparing, I restored my eventsystem game object, I removed the input manager component as I had before and replicated the same as I had on the main project I was working on, so at the end I have a game object looking like this:

    Screenshot 2023-07-09 230457.png


    That alone didn't work, then I checked the canvas and I saw 2 major differences, the working project didn't had the additional shaders channel, but I don't think that affects anything but I had the Canvas Group set as the one shown below here with
    • Interactable true
    • Blocks Raycasts false ⚠️
    Screenshot 2023-07-09 230639.png


    And surprise surprise, I needed to ENABLE the damned Blocks Raycasts. Checking that one on finally made my screen work again like it used to do in the old input system - needless to say I have obliterated the canvas group component out from my canvas.
    What's even more enraging is that I am 100% sure I fiddled around with all the settings in my Canvas to no result, but I guess the conjunction of that minimal EventSystem gameobject above and the change on the canvas made the thing work for good.

    Sticks works, all buttons works, I am happy again.
    As a bonus during my troubleshoot hunting I found this fine lady that explains the new input system VERY well including the double fire issue I was having on the keyboard controls - didn't help me directly but I have to give her credit where is due, I'll recommend a watch for everyone.



    Hope it helps
     
  14. skaplan70

    skaplan70

    Joined:
    Aug 21, 2020
    Posts:
    1
    Thank you! This was the fix for me. I installed the 3rd person character controller (uses Starter Assets Inputs) and the new Input system was a prerequisite so it installed first. Movement was fine, but a button click would cause the cursor to just disappear with no action. The button only worked if I fully disabled the character, but I couldn't narrow down the problem beyond that. I can't believe that's all it was.
     
  15. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    212
    Did you found a solution ? I have the exact same issue with Unity 2021.3.20f1 and input system 1.5.1
     
  16. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    212
    Ok found that on my Pause menu, the Sort Order in canvas was default 0. Like sprites on my HUD. set default 1 and it is ok.

    But I have also remove EventSystem and InputSystemUIInputModule and recreate it. Remove reference from my PlayerInput to it as it is a solo game.