Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can't click UI Buttons

Discussion in 'UGUI & TextMesh Pro' started by xFrost96x, Sep 14, 2016.

  1. bg4u67

    bg4u67

    Joined:
    Sep 20, 2020
    Posts:
    1
    You're an absolute life saver. I've been trying for at least 10+ hours to fix this issue, so thank you so much!
     
  2. unknownsk

    unknownsk

    Joined:
    Jan 16, 2020
    Posts:
    36
    Another solution for random person: NEVER EVER ROTATE BUTTON ON Y-AXIS. I do not know why but if you rotate the button 180 degrees on the y-axis you can not click on it anymore! so use the z-axis.
     
  3. unknownsk

    unknownsk

    Joined:
    Jan 16, 2020
    Posts:
    36
    Hi if anybody is still having this problem, I got the solution and I think this is your problem because every other solution is already posted. Just simple: Make sure you never rotate UI object on the Y axis. It makes UI component to not be clickable! Set rotations to 0! UI object is 2D component. Rotate it on the Z axis if you still want to rotate it and not on the Y axis.
     
  4. Jared_Pitchford

    Jared_Pitchford

    Joined:
    Jul 7, 2018
    Posts:
    3
    EventSystem: Input System UI Input Module (Script)
    Make sure Deselect on Background Click is turned off. This can cause this behavior.
    Sometimes stuff behind the UI does an update and suddenly button navigation behavior goes out the window.
     
  5. markustangen

    markustangen

    Joined:
    Feb 27, 2022
    Posts:
    1
    I would kiss you.
     
  6. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,632
    I found that in my button prefab I had the "image" object off, even setting this on at runtime didnt work, needs to be done in the prefab before you run.
     
  7. Joropval

    Joropval

    Joined:
    Feb 9, 2022
    Posts:
    1
    i didnt have a eventsystem
     
  8. SheepieDuh

    SheepieDuh

    Joined:
    May 29, 2022
    Posts:
    1
    Thank you sooooo much I straight up gave up my project for a day because of that
     
  9. StarArcher

    StarArcher

    Joined:
    May 23, 2020
    Posts:
    12
    4 1/2 years later... this saved my bacon. Thank you!!!!
     
    radiantboy likes this.
  10. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,632
    true, without the standalone module I couldnt get it to work! thanks
     
  11. Rowland_Goddy-Worlu

    Rowland_Goddy-Worlu

    Joined:
    Jan 24, 2021
    Posts:
    3
    Kindly check if you deleted the event system that is automatically created with the UI elements. If you mistakenly deleted that, you can re-add the event system by simply creating a new canvas.
     
  12. feryad95

    feryad95

    Joined:
    Jul 25, 2022
    Posts:
    1
    guys make sure you have GraphicsRaycaster component on you parent canvas, none of my buttons worked added GraphicsRaycaster to my canvas and boom
     
  13. stromtroopergamer356

    stromtroopergamer356

    Joined:
    Dec 7, 2020
    Posts:
    1
    Finally! Thank you! You just reminded me that I forgot to add one... I deleted the previous event system by accident and forgot about it, and I was like... "Why buttons not work" LoL XD
     
  14. popcar2

    popcar2

    Joined:
    Sep 5, 2019
    Posts:
    4
    In my case it turns out I was missing an EventSystem. It should've put one automatically but I think it didn't when I copy-pasted a canvas from another scene. Whoops!
     
  15. jimisv52

    jimisv52

    Joined:
    Jul 18, 2022
    Posts:
    1
    oh my god thank you I had this problem for so long and it was just because I had my canvas in the wrong order
     
  16. SomeVVhIteGuy

    SomeVVhIteGuy

    Joined:
    Mar 31, 2018
    Posts:
    162
    happens all the time when you manually place things in the Hierarchy. The biggest 3 troubleshoots are placement order, sorting layer, and missing an event system
     
  17. Coolae

    Coolae

    Joined:
    Mar 29, 2020
    Posts:
    1
    Sorry to revive this thread again, but for me it was that i did not reference the event camera in my canvas
     

    Attached Files:

  18. CasperSparkle

    CasperSparkle

    Joined:
    Nov 15, 2017
    Posts:
    1
    For anyone not finding anything that works, what eventually worked for me is that I somehow had Canvas properties on my buttons. No idea what led to that, this whole process has been a blur lol
     
    theglobol likes this.
  19. daksh82010

    daksh82010

    Joined:
    Jun 6, 2021
    Posts:
    1
    THANKS SO MUCH, it helped me a lot!
     
  20. gokusan523552

    gokusan523552

    Joined:
    Dec 20, 2022
    Posts:
    1
    Thanks man, it seems I have accidentally deleted event system in the hierarchy
     
  21. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    @mikael_juhala wow, thank you. I had an invisible element covering my button, that I'd completely forgotten about. Your hint about using the EventManager to debug was fantastic! Thank you :)
     
  22. jayconsystems

    jayconsystems

    Joined:
    May 14, 2019
    Posts:
    4
    What solved it for me was changing the Canvas GameObject -> Render Mode -> Sort Order -> 1.
    For some reason Sort Order == 0 was not working for me, only Sort Order == 1 was.
     
  23. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,632
  24. unity_3872EF064E8805AEF2F3

    unity_3872EF064E8805AEF2F3

    Joined:
    Feb 6, 2023
    Posts:
    1
    Thanks! I was banging my head for a while on this one, I am not sure how my EventSystem was deleted but adding it back in solve the problem!
     
  25. sagarsuman1299

    sagarsuman1299

    Joined:
    Feb 29, 2020
    Posts:
    1
    If above stuffs don't work and your code has this :
    Cursor.lockState = CursorLockMode.Locked;
    Try removing or commenting that.
     
  26. tmkirankumar

    tmkirankumar

    Joined:
    May 24, 2023
    Posts:
    4
    Make sure Event System is turned On. If Evernt system not present, do add manually for the issue of not able to click or enter on game play mode.
     
  27. mohamedkaram09

    mohamedkaram09

    Joined:
    Oct 13, 2019
    Posts:
    7
    An absolute legend
     
    radiantboy likes this.
  28. OpenGLMaster

    OpenGLMaster

    Joined:
    Jan 4, 2023
    Posts:
    3
    SAMEEEEEEEEEEEEEEEEEE
     
  29. daniel2kinga_unity

    daniel2kinga_unity

    Joined:
    Dec 28, 2021
    Posts:
    1
    The resolution of the problem is that you have to put EVENT SYSTEM on the canvas and then Standalone Input System, it will work for sure
     
  30. Jahvan

    Jahvan

    Joined:
    Feb 1, 2017
    Posts:
    10
    Another problem that can arise — which happened to me: If a parent element of the button has a mask, and the button is outside of the mask, it won't respond to raycasts. This is true even if the image of the button has "Maskable" unchecked.
     
  31. iZerv

    iZerv

    Joined:
    Dec 18, 2021
    Posts:
    1
    Madep maneh euy
     
  32. paul_unity171

    paul_unity171

    Joined:
    Jun 11, 2020
    Posts:
    1
    Thank you :) I had made my canvas into a prefab, and added it to all scenes. 1 scene did not already have an event system, so my canvas was not working. Rookie mistake I know.
     
  33. theglobol

    theglobol

    Joined:
    Sep 22, 2023
    Posts:
    1
    Thank you. Your solution fixed my problem.
     
  34. WazeJinx

    WazeJinx

    Joined:
    Feb 13, 2023
    Posts:
    1
    having same problem, i have to spam esc (to bring up canvas that has button) and for a mere second it detects my mouse on the button then it doesnt detect anymore. :( still unsolved
     
  35. garwil80

    garwil80

    Joined:
    Dec 5, 2023
    Posts:
    2
    This is driving me mad!!! Hoping someone can help!

    3 things I noticed:
    1. When I change from "Game" view to "Simulator" the buttons click
    2. When I sue the camera in this "Character Controller SUPER" it doesn't work, however when I just use a normal camera it works
    3. When I try "New Input System" (see instructions below) It causes error an error after a restart, and I have to start in safe mode with these errors "Assets/SUPER Character Controller/SUPER Character Controller/SUPERCharacterAIO.cs(12,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)" ??? Any suggestions? is there a character controller that's compatible and up to date with the latest version of unity?
    "New Input System"
    • Input System Package: Confirm that the Input System package is installed via the Unity Package Manager.
    • Player Settings: Go to Edit → Project Settings → Player, and under the Other Settings tab, make sure the Active Input Handling option is set to either Input System Package (for exclusively using the new system) or Both (to support both the old and new systems).
     
  36. drilya1989

    drilya1989

    Joined:
    Jul 23, 2023
    Posts:
    1
    why aren't my buttons clickable?? upload_2024-2-4_19-6-36.png
     
  37. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,475
    @drilya1989 have you tried these?
    If I have to guess you have either
    1. something in front of your button with raycastTarget set true that's capturing the clicks so your button doesn't get clicks anymore
    2. your button's graphic doesn't have raycastTarget set true.