- Home /
Block OnMouse~ whith UI
i want
public void OnMouseUpAsButton()
{
print("this gameobject is clicked")
}
this to not work when collider is under the UI with layermask "UI" raycast wont work..... i dont even know what i'm writing now.
just help me..
i have a card(GameObject)
card has world space canvas
card has a box collider and "OnMouseUpAsButton" method in its script.
i have a Screen Space-Overlay canvas and that has a button.
when i press that button, OnMouseUpAsButton gets called too
so i used
UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()
and that blocks my card both from canvas in the card and the button.
i want card's canvas not to block card and only overlay canvas button to block my card.
// my card's canvas' layout(layer mask) is "default" and overlay's is "UI" -> reference this when your solution uses raycasting