I am trying to create a marble run game where once you hit a black circle named "Sphere" with "Ball" the Ball either instantiates a new prefab of the ball again named "Ball" at the starting point of the original ball and destroys the old one OR the ball simply gets moved back to its original starting point. at the moment i have this code which instantiates the new prefab but at the point where the collision happens, also i'm not sure how im supposed to delete the original ball, hence why id rather just move it back to its starting point on collision. any suggestions or help would be greatly appreciated.
var ball : GameObject;
function OnCollisionEnter(theCollision : Collision) {
if (theCollision.gameObject.name == "Sphere"){
var instance : GameObject = Instantiate(ball, transform.position, transform.rotation);
}
}