death spot re spawns prefab and loose life

within my game i have these flat spheres where if my ball rolls over them they should destroy the ball and re spawn its prefab. this should be linked to the lives system where they have 3 and for every time they re spawn they loose a life. this is my code:

static var Life: int = 3;

    function OnCollisionEnter (theCollision : Collision)
    {
        if (theCollision.gameObject.name == "ball")
        {
            Destroy (theCollision.gameObject);
            Life --;
        }
    }

not only does it not even seem to destroy the ball object anymore i'm not certain on how to re spawn the prefab or on how to link it to the lives ( i tried to do this via 'Life --:'). i have given this a go numerous times and this is the script i've finished with. please could someone help?

First off, why destroy the ball if you're just going to re-instantiate it? If you just reset the position of the ball, then you could have a script on the ball, where you counted down the lives.

But anyhow. You can instantiate a new ball object by:

GameObject.Instantiate(prefab, position, rotation);

The prefab should be a reference to your ball prefab.

To count down the lives you could create a script that manages all the player information, like lives. Then use this, because destroying the ball will also destroy the scripts on it. Not really that great, if you ask me :)

Why your current doesn't work? Well, you did remember to call your ball for "ball"? And that at least one of them should be a non-kinematic rigidbody?