- Home /
First comment helped to solve the question.
2D Sprite blocks onPointerClick?
Hi,
I have a grid based board game, where each field is receiving clicks or touch events with "onPointerClick". This works fine, but I have some camera sprites on some fields, whick are blocking the clicks on the field below. How can I avoid this?
Any ideas?
thanks in advance Frank
Hi,
i never worked with the onPointerClick but maybe you could change the physic matrix and work with layers. I dont know if the onPointerClick uses Raycasts.
http://docs.unity3d.com/$$anonymous$$anual/LayerBasedCollision.html
http://docs.unity3d.com/$$anonymous$$anual/class-Physics2D$$anonymous$$anager.html
http://docs.unity3d.com/$$anonymous$$anual/class-Physics$$anonymous$$anager.html
I fixed it. I set the camera to the "ignore raycast" layer and in my Physics2DRaycast I disabled the event on the "ignore raycast" layer.
You should change your comment to an answer.