- Home /
Question by
softmarshmallow · Jul 12, 2016 at 06:47 PM ·
uibuttoncanvasonmousedown
block clicking gameobject behind ui
im using
public void OnMouseDown(){
print("this gameobject is clicked")
}
but i would like to block mouse clicking it when im clicking the ui(space overlay) i think blocksraycasr thing doesnt work... i want to using worldspace ui for the solution or add variables to check if the ui in on... any fundamental solutions for this????
Comment
Answer by chomps32 · Jul 12, 2016 at 07:40 PM
I think what you are looking for is LayerMask. Here is a very detailed explanation:
http://answers.unity3d.com/questions/8715/how-do-i-use-layermasks.html
here is a simpler answer that is more tuned towards your question:
http://answers.unity3d.com/questions/416919/making-raycast-ignore-multiple-layers.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612084714im_/https://answers.unity.com/themes/thub/images/avi.jpg)