Search Unity

HUD blocking Physic.raycast

Discussion in 'UGUI & TextMesh Pro' started by Kirby26, Feb 10, 2020.

  1. Kirby26

    Kirby26

    Joined:
    Mar 3, 2019
    Posts:
    13
    Hi. i have a problem with this. I select things in the game with a physic raycast from the camera. And, if i click in the HUD, and a go its under the hud. i click in the hud and select the go at the same time.

    Raycast target doesnt work for this on HUD, and canvas group neither.

    Someone can help me?

    thanks
     
  2. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    I happened to have the save issue. I figured out you need to use GraphicsRaycaster for UI elements and the PhysicsRaycaster for, well.. physics! :p
     
  3. Kirby26

    Kirby26

    Joined:
    Mar 3, 2019
    Posts:
    13
    Oh, i forgot to put this here:

    if (EventSystem.current.IsPointerOverGameObject() == false)
    {
    blabla
    }

    that makes what i want.
     
  4. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Nice one. That... might actually simplify some of my own code!