Search Unity

GUI Button, doesn't work in World Space.

Discussion in 'UGUI & TextMesh Pro' started by Otactu, Aug 27, 2014.

  1. Otactu

    Otactu

    Joined:
    May 22, 2014
    Posts:
    24
    So,

    If i'm in "Screen space - Overlay " mode in canvas. Button works.

    And if i'm in "World Space", button does'nt react.

    Any idea ? (I tried five time from scratch with almost all the setting I see ><)
     
  2. Otactu

    Otactu

    Joined:
    May 22, 2014
    Posts:
    24
    Problem Solved :

    You have to select a camera, in "Canvas < Render Mode < Event Camera" :)
     
  3. cowmeat

    cowmeat

    Joined:
    May 23, 2014
    Posts:
    1
    thanks had the same problem!
     
    iminimin and k-ina like this.
  4. paulrich_nb

    paulrich_nb

    Joined:
    Feb 22, 2016
    Posts:
    1
    Thanks was having same problem.
     
    k-ina likes this.
  5. Deleted User

    Deleted User

    Guest

    Thank you so much Otactu, I've been having this problem for weeks now and thought about the RayCaster and button texts and Canvas's, also backrounds and about the canvas being in the negative in the scale, but this was the problem all along. Thanks much!!!!
     
    k-ina likes this.
  6. rifaterdemsahin

    rifaterdemsahin

    Joined:
    Sep 3, 2016
    Posts:
    8
  7. ERADEMIR

    ERADEMIR

    Joined:
    May 27, 2015
    Posts:
    3
    If its not the case also try removing check on Graphic Raycaster > Ingore Reversed Graphics on WorldSpace Canvas which worked for me.
     
    dilavermai, quyetnd1, y01cu and 18 others like this.
  8. hema_dubal

    hema_dubal

    Joined:
    Oct 27, 2016
    Posts:
    6
    Oh this worked for me! Thanks a lot :D
     
    Shahid0090 likes this.
  9. sedat38

    sedat38

    Joined:
    Apr 2, 2017
    Posts:
    1
    If you still having this issue check if your event camera is in front of your world space canvas. It may be able to see behind because of Clipping Planes parameters.
     
    joker_yash96 and stefanbendrin like this.
  10. OneCredit

    OneCredit

    Joined:
    Aug 31, 2017
    Posts:
    3
    Totally work for me!!
    Thank you very much!!
     
    k-ina likes this.
  11. UnityTester33

    UnityTester33

    Joined:
    Dec 17, 2016
    Posts:
    7
    This works for me as well
     
  12. bapplegate

    bapplegate

    Joined:
    Nov 19, 2015
    Posts:
    1
    ALSO -> Make sure you do not have a VR headset plugged in!
     
    Kristis, LiamGallagher964 and Stupzz like this.
  13. H-Ishfaq-Ahmad

    H-Ishfaq-Ahmad

    Joined:
    Aug 1, 2017
    Posts:
    1
    Thanks . it solved my problem
     
    k-ina likes this.
  14. o-san

    o-san

    Joined:
    Jun 23, 2018
    Posts:
    32
    I’m having the same problems but the above solutions does not help. Ive read through and looked at the various unity docs and videos.

    The event camera is set and I have tried setting the ignore reversed graphics checkbox. Are there any other considerations i might have missed?

    I can’t see anything that might block the camera view and the buttons are visible. Is there a way to debug what the selection ray hits?
    ____
    edit:
    solved it, had another canvas on top of the one I was trying to interact with. It was in screen overlay mode. When going through the scene view and trying to figure out if anything blocked the rays it didn't show (quite obvious since it was in overlay mode).
     
    Last edited: Jan 9, 2019
    nailacrooc12, iharin, OBRG2 and 6 others like this.
  15. davalosweldon

    davalosweldon

    Joined:
    Jan 31, 2018
    Posts:
    4
    The problem for me was that the ARCamera in scene was culling everything except UI. I changed the Layer of the canvas to default and it fixed the problem.
     
  16. SummerBearStudio

    SummerBearStudio

    Joined:
    May 2, 2018
    Posts:
    1
    If turning on reverse raycasting worked for you, you probably rotated the world space canvas so that its forward vector it pointing away from the camera. You can fix this by rotating it around so that the green translation gizmo points towards the camera. Turning on reversed raycasting will fix the problem, but you may get weird behavior in more complicated setups!
     
    viknesh2020 likes this.
  17. Birgere

    Birgere

    Joined:
    Feb 8, 2016
    Posts:
    22
    If any of this still isn't working, try moving the EventHandler so that it isn't inside the Canvas inside the hierarchy.
    Also make sure you've got one aswell.
     
    LiamGallagher964 likes this.
  18. Stupzz

    Stupzz

    Joined:
    May 21, 2018
    Posts:
    1
    That worked for me, thanks!
     
  19. CityWizardGames

    CityWizardGames

    Joined:
    Nov 6, 2013
    Posts:
    21
    If all of this still isn't working for you, try increasing the "Order in Layer" on the Canvas.
     
    SunnyGoswami and Louie-Wolf like this.
  20. gareth_untether

    gareth_untether

    Joined:
    Jan 5, 2018
    Posts:
    69
  21. timecomplexity

    timecomplexity

    Joined:
    Dec 29, 2017
    Posts:
    1
    When I encountered this issue (except even when changing to Screen Space - Overlay it still wasn't working) through some copy+paste error, I managed to not bring the EventSystem object over and so the buttons didn't work. Silly mistake. :)
     
    demoooo and Nadogeto like this.
  22. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Make sure your button looks in the right direction. It must look along with the camera forward vector. Not face the camera.
    Or
    Uncheck 'Ignore Reversed Graphics' on GraphicRaycaster
     
    viknesh2020 likes this.
  23. Louie-Wolf

    Louie-Wolf

    Joined:
    Feb 2, 2016
    Posts:
    2
    thanks this one solved my problem lmao

    love how 5 different problem types got solved because someone solved his own problem
     
  24. BudsofBuds

    BudsofBuds

    Joined:
    Dec 7, 2018
    Posts:
    9
    Chiming in to ad... make sure there is a Graphics Raycaster component on your canvas. This was my problem all along.
     
    maxiping20 likes this.
  25. leezak5555

    leezak5555

    Joined:
    Jan 16, 2020
    Posts:
    11
    GUYS IF ANY OF YOU ARE HAVING THIS PROBLEM AND FOUND NO FIX:
    I was sitting here over 2 weeks trying to find a solution


    MAKE SURE THE ROOT OBEJCT OF THE CANVAS DOES NOT HAVE A RIGIDBODY ATTECHED

    If it has a Rigidbody, simply freeze the x,y,z positions of it

    I hope I saved you some time...
     
  26. God0fMagic

    God0fMagic

    Joined:
    Feb 8, 2019
    Posts:
    17
    I had the same issue, but solution was a bit different.
    In our project we have VR plugins, but I was just testing things with mouse, so Camera component by default had "Target Eye" set to "Both". Setting it to "None" fixed the issue.
     
  27. Qmansvednetta

    Qmansvednetta

    Joined:
    Mar 8, 2017
    Posts:
    8
    This did it for me! Thanks!
     
  28. ereneker

    ereneker

    Joined:
    Nov 17, 2019
    Posts:
    1
    Thank you so much! It worked for me. Took me 2 hours to solve this.
     
  29. demoooo

    demoooo

    Joined:
    Feb 13, 2020
    Posts:
    2
    Well that fixed my problem thank you and agree wih you with all my cells :)))
     
  30. AnahidE5

    AnahidE5

    Joined:
    Jan 10, 2022
    Posts:
    40
    Finally fixed my issue. Thanks and wow. Would have not been able to figure it out on my own.
     
  31. godoy1995

    godoy1995

    Joined:
    Mar 3, 2022
    Posts:
    1
    Thanks for that.
     
  32. y01cu

    y01cu

    Joined:
    Oct 10, 2021
    Posts:
    8
    Thanks!
     
  33. aldenchappell

    aldenchappell

    Joined:
    Sep 11, 2022
    Posts:
    3
    Absolute life saver. Had my players UI in the way even though nothing was showing on it. Disabled that when I needed to access the world space canvas, worked flawlessly. Thank you!!!!
     
  34. gamesrightmeow

    gamesrightmeow

    Joined:
    Mar 7, 2018
    Posts:
    1
    In addition to the things people suggested above: In 2021.3 if you have VR enabled (i.e. you have VR packages enabled in the package manager), world space canvases won't respond to mouse input until you change Target Eye to None (Main Display).

    upload_2023-10-23_10-33-38.png