Search Unity

Can't click UI Buttons

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

  1. xFrost96x

    xFrost96x

    Joined:
    Nov 7, 2015
    Posts:
    3
    Hi , why my button can't be pressed??

    Here is my screenshot:
     

    Attached Files:

    ultraon83 likes this.
  2. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    - Make sure the graphic has "raycastTarget" set to True.
    - Make sure the button has its "interactable" set to True.
    - If there's a nested canvas in the button's parent, that canvas also needs GraphicsRaycaster.

    If all those are fine, then start the game, select your EventSystem and click your button. At the bottom of the inspector you'll see what your click hit (in that dark box that is visible in the first screenshot). It might be something else capturing the click before the buttons.
     
  3. Shippety

    Shippety

    Joined:
    May 9, 2014
    Posts:
    31
    I added GraphicsRaycaster to the parent and it fixed my problem! Thanks so much!
     
  4. TinkersEdge

    TinkersEdge

    Joined:
    Oct 4, 2016
    Posts:
    6
    Thank you!!Thank you!! Thank you!! Thank you!! Thank you!! Thank you!! Thank you!! Thank you!! Thank you!! I spent the last three hours looking for the reason why my buttons weren't working. I knew something had to be blocking them but couldn't figure what. You are the first and only person that I have found that game me an actionable way (besides going through every object in my scene) to figure out what was the problem. YAY!!!!:D
     
  5. freakymango1

    freakymango1

    Joined:
    Jan 15, 2017
    Posts:
    1
    EventSystem?
     
  6. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    An event system should be automatically added to your scene when you add a canvas. If you need one for something else (and have no canvas), you can add it yourself. You can also add it yourself if you accidentally deleted it :)
     
  7. hungtv

    hungtv

    Joined:
    Jul 10, 2018
    Posts:
    1
    Awesome! Thanks, man.
     
    NiRoU21 likes this.
  8. LaconicGames

    LaconicGames

    Joined:
    Aug 12, 2017
    Posts:
    4
    If your still having problems after doing the above I found that my problem was that in the buttons 'On Click ()' settings. I had set for the button to change the sprite in an image component although I had left the sprite reference equal to none. Make sure you guys haven't left out any references in the 'On Click()' settings.
    This is what the problem was:
    Capture.PNG
     
  9. SomeVVhIteGuy

    SomeVVhIteGuy

    Joined:
    Mar 31, 2018
    Posts:
    162
    Id just like to say be sure you have things "ordered" correctly in your manager. It looks like your buttons may be behind your panel.
     
  10. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    112
    In my case I forgot that I had a canvasgroup component on the button's parent. The "Interactable" and "Blocks Raycasts" options have to be ticked to allow the interaction with the child buttons.
     
  11. canakgol

    canakgol

    Joined:
    Dec 5, 2018
    Posts:
    1
    here is my screenshots. I still can not click on UI button!
     

    Attached Files:

  12. HKNormann

    HKNormann

    Joined:
    Aug 28, 2018
    Posts:
    3
    Aw damn. Seems like I did just that. Finally I know why nothing's working. Did a bit too much cleanup in my project files :rolleyes:
     
    Plarp and Duragon76 like this.
  13. CJMyerscough

    CJMyerscough

    Joined:
    Oct 1, 2018
    Posts:
    2

    I didn't have an events system in my scene, putting one in solved my problem.
     
    T0K10, Plarp, Bereeco and 6 others like this.
  14. PabloRodriguez

    PabloRodriguez

    Joined:
    May 10, 2019
    Posts:
    1
    Hi, I can click on my button when I use it on windows (game view) but is not detecting my gestures when I run in the hololens. I want to reproduce an animation for a UI. everything works fine besides the clicking.
     
  15. godspowerjemifor

    godspowerjemifor

    Joined:
    Jun 19, 2019
    Posts:
    3
    How did you solve the problem I'm having the same issues

     
  16. gowthamrajbio

    gowthamrajbio

    Joined:
    May 20, 2019
    Posts:
    2
    Thank You :)
     
    voidstream likes this.
  17. bsymon

    bsymon

    Joined:
    Dec 11, 2016
    Posts:
    18
    Yup, sorry to revive this old thread again !

    But if you still can't click on your button even with all the solutions above, make sure your GameObject with the button component has an Image component ! It can happens if your "Target graphic" is not the same GameObject, so you only put the Button component and no image ... You still need an image ... Set its opacity to 0.

    I just got this problem, and could not figure out what caused it ... For the last 10 minutues or so :)
    Hope it help
     
  18. bhaveshakoliya

    bhaveshakoliya

    Joined:
    Oct 29, 2019
    Posts:
    1
    Thanks. i deleted that one.
     
    Plarp and mfatihbarut like this.
  19. mystrymaster

    mystrymaster

    Joined:
    Oct 30, 2019
    Posts:
    6
    HOLY CRAP thank you so much for this post oh soo long ago

    I had the enable raycast targets on all the panels and check off both interactable and Blocks raycasts on the canvas grouping and then finally the button was firing. WOW. That took too long to figure out and finally after typing "button wont enable click unity" into google did this thread pop up.

    I hope no one ever has to lose that time again.
     
  20. Delirious12

    Delirious12

    Joined:
    Dec 3, 2019
    Posts:
    1
    Mine Fixed when I put back the EventSystem, because I deleted it. So don't delete EventSystem.
     
    redmotion_games likes this.
  21. Vedronor

    Vedronor

    Joined:
    Dec 10, 2019
    Posts:
    1
    Thank you!!
     
  22. prathmahajan1996

    prathmahajan1996

    Joined:
    Apr 13, 2019
    Posts:
    1
    I had to turn off the raycast target on the text element I had added on the UI button
     
    talkingcommunities likes this.
  23. Spaceshark123

    Spaceshark123

    Joined:
    Jan 11, 2020
    Posts:
    2
    thanks so much I had put a panel on top of the button and that was why the button wasnt clicking
     
  24. a88236

    a88236

    Joined:
    Aug 29, 2019
    Posts:
    1
    I have met this problem when create new scene and copy canvas with buttons.
    Create or copy EventSystem also.
     
    Navii0 likes this.
  25. wa4lnut

    wa4lnut

    Joined:
    Apr 26, 2020
    Posts:
    2
    Lol I forgot to add a event system
     
  26. Enumerator_T

    Enumerator_T

    Joined:
    Nov 5, 2014
    Posts:
    16
    Also if anyone else has a problem, Like i just did where no matter what you did didn't fix it, then look for 'Event System' and see if you have more than one! and don't delete the one you need LOL!
     
  27. perkays

    perkays

    Joined:
    Jul 10, 2020
    Posts:
    2
    Canvas > set order > 1 or 2
     
  28. IIxJOHNxII

    IIxJOHNxII

    Joined:
    Aug 26, 2020
    Posts:
    1
    Go to "Project Settings", "Input Manager" and reset it. In my case it work fine.
     
    iZerv likes this.
  29. Kerios

    Kerios

    Joined:
    Feb 18, 2019
    Posts:
    1
    perfect thank you very much !!
     
  30. celinedrules

    celinedrules

    Joined:
    Jan 31, 2013
    Posts:
    17
    My issue was I had a couple other UI elements that all belong to the same canvas group. There alpha was set to 0 so I couldn't see them but that was what was blocking my buttons. All I had to do is move the UI element that contained my buttons down below the others in my hierarchy.
     
  31. JamPanda99

    JamPanda99

    Joined:
    Oct 22, 2020
    Posts:
    1
    Thanks, I had deleted mine :p
     
  32. ziadalnagdev

    ziadalnagdev

    Joined:
    Dec 17, 2020
    Posts:
    1
    Thank You all, The EventSystem sol worked for me
     
  33. sabailuridze

    sabailuridze

    Joined:
    Jan 3, 2021
    Posts:
    5
    Thaaaanks :), EventSystem worked for me, :)
     
  34. Chuck_S

    Chuck_S

    Joined:
    Dec 11, 2018
    Posts:
    15
    Wanted to add here that just adding an event system isn't enough - you also need the Standalone Input Module.

    Really, the easiest way to handle getting the Event System right is to delete any that you added, then right click a GameObject and go to UI > Canvas. When you add it then Unity will auto-create the stuff you need to use it on a new GameObject called "EventSystem."

    Copying canvases, menus, etc. will not create the event system.
     
    radiantboy likes this.
  35. mgabriele1

    mgabriele1

    Joined:
    Feb 5, 2021
    Posts:
    1
    you are a blessing thank you
     
    StarArcher likes this.
  36. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    137
    Also make sure enable Block Raycast if you have Canvas Group.
     
  37. NEITbwdameworth

    NEITbwdameworth

    Joined:
    Aug 17, 2020
    Posts:
    1
    Ohhh. I had a button that wasn't working and none of the other solutions in this thread were for me. Turns out my scene was missing an EventSystem so it wasn't registering clicks AT ALL! Thank you :)
     
  38. UANGaming

    UANGaming

    Joined:
    Mar 23, 2020
    Posts:
    1
    You're a F***ing legend mate!
     
  39. tomosbach

    tomosbach

    Joined:
    Feb 25, 2021
    Posts:
    7
    You are a hero, thank you!
     
    StarArcher likes this.
  40. Joe_The_Bro

    Joe_The_Bro

    Joined:
    Apr 5, 2021
    Posts:
    1
    Adding an event system fixed this issue for me. It turns out when I copy pasted my canvas from one scene to another, I left my EventSystem behind!
     
  41. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Well I've tried EVERYTHING on this thread and nothing works. This new input system is the worst, most over the top and complicated system I've ever used in unity. Did an actual UX designer help create this, or just a programmer?

    I've spent hours and hours and can't work it out. AT ALL. Prior to this system I could do a simple OnMouseDown or just throw the button in the scene and it worked no issue. Now I have to jump through hoops and still keep missing.
     
    reinfeldx likes this.
  42. whoisgliese

    whoisgliese

    Joined:
    Jun 4, 2020
    Posts:
    8
    What fixed it for me was changing the canvas order: one canvas was being drawn on top of the canvas with the button. Bigger value, the more on top it'll be
     
  43. EdarDaniel2021

    EdarDaniel2021

    Joined:
    May 4, 2021
    Posts:
    3
    Its was my problm !! i was did thais at prefab!! and dont understand why not Work!
     
  44. LQPewds

    LQPewds

    Joined:
    Nov 12, 2020
    Posts:
    25
    still doesnt work ive tried LITERALLY EVERYTHING UUGhGhGhUGHG
     
  45. AreejAlrashidi

    AreejAlrashidi

    Joined:
    Aug 9, 2021
    Posts:
    1
    Same ): pls tell me you found a solution to this issue
     
  46. jinna124

    jinna124

    Joined:
    Aug 5, 2021
    Posts:
    1
    i updated my eventsystem componet from standalone input module to input system UI input module and it worked :)
     
    MirrorO_O and mercurous like this.
  47. mercurous

    mercurous

    Joined:
    Aug 19, 2021
    Posts:
    1
    Yes for some reason when I created mine it did not automatically put in an event system. So add yours in to the canvas, and click the button when the warning pops up to convert it. Thank you to everyone above and good luck everyone below.
     
  48. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Tried everything in this thread. I finally added the new Input System and set the player settings to use it and restarted. No dice. I then added back the old Input manager so both were active at the same time, restarted and the show stopper stopped stopping the show. The buttons work and I can get back to work. 2020.3.18f1.
     
  49. talkingcommunities

    talkingcommunities

    Joined:
    Mar 11, 2016
    Posts:
    1
    That was my solution. Thanks
     
    MissFisher likes this.
  50. nathan2019spence

    nathan2019spence

    Joined:
    Jan 21, 2022
    Posts:
    19
    LOL...arghhh......I had created a new screne added the canvas the buttons everything was going great, but then I added a third person player and in the prefab had its own event system and my canvas would no longer work...ahhhhh