Why the collisions are detected randomly?

Hi everyone,

I am trying to detect the collision between two object. Basically there are 5 spheres that will collide whit a slightly moving object. First the first sphere, than I will put the gravity to the second one and so on. Everytime I destroy the collided sphere. In the last sphere I reset the scene. I print “collision detected (name_of_the_sphere)” everytime that the collision happens. The problem is that sometimes is really random. In particular the collision detected sometimes appear twice for some sphere, sometimes only once, then 2 times…how is it possible?

ps: the object on which the spheres impact is kinematic

void OnCollisionEnter(Collision col)
    {
        print("Collisione center");

        GameObject altodx = GameObject.Find("altodx");
        Rigidbody rb = altodx.GetComponent<Rigidbody>();
        rb.useGravity = true;

        //play the audio
        cube.GetComponent<AudioSource>().Play();
       
        GameObject center = GameObject.Find("center");
        Destroy(center);

you need to check from what you are colliding so usually you either check by a tag or name, something like

void OnCollisionEnter(Collision col)
         {
             if(col.gameObject.CompareTag("Sphere")){
                 print("Collisione center");
             }
         }

So now it will know that yeah i collided with the Sphere and now i have to print “Collision centre”.

Not really solved…Is still random from time to time… I don’t know what else to try.
So I am trying to disable the script after the first execution and re enable it later during the execution of the scripts of the other spheres.

UPDATE: after the collision I disable the detection of the collision like this:
GetComponent().detectCollisions = false;

and then I reactivate the collision detection on another sphere. BUT STILL sometime it count 2 collision instead of one! is impossible!! Theoretically after the first one the detection is disabled! how is it possible that it print two times “collision detected”!!!