I have a canvas with a panel with set width / height inside. The canvas rendermode is set to ScreenSpace Overlay.
My clicks on the panel are falling through and hitting the game objects below triggering their mouse events.
The little green circle is a Sprite with the following event
public void OnMouseDown() {
Debug.Log("click");
Vector3 newPos = Camera.main.WorldToScreenPoint (this.transform.position);
newPos.x -= panel.GetComponent<RectTransform>().rect.width / 2.0f;
newPos.y -= panel.GetComponent<RectTransform>().rect.height / 2.0f;
panel.transform.position = newPos;
}
I've been reading through the docs but I'm missing something... How do I stop my clicks hitting the game objects below the panel?
Blocks raycast
checkbox enabled ? \$\endgroup\$