I am trying to get the gameobject which is touching the current gameobject.suppose I am dropping different types of colored balls in a container and want to destroy if the ball is in contact with the similar ball.I also want to get the ball next to the ball that is in contact with the current ball.
suppose Ball A is in contact with Ball B and Ball B is in contact with Ball C.now if Ball A wants to know which ball is in contact with Ball B(i.e BALL C).how can i do this please help me out.
You can either use Overlap Sphere to find all gameobjects with colliders within a radius or you can use OnCollisionStay to perform an operation on objects with colliders continually in contact. Either way, you need colliders and most likely rigidbodies on your objects.