Hello, I am building a simple 2D games with balloons.
The problem is when I want to destroy overlapping balloons, sometimes it works fine, but sometime more ballons are destroyed.
I want to destroy only first balloon.
Here is my code:
RaycastHit2D hit = Physics2D.RaycastAll(Kamera.ScreenToWorldPoint(Input.mousePosition), Kamera.ScreenToWorldPoint(Input.mousePosition));
if (hit.Length > 0)
if (hit.collider == polygonCollider)
I have tried everything that I know but nothing works well.