Hi, I’m new to Unity and I’m trying to create a game where a basketball is shot at a target, and if it hits the target it disappears and respawns. I’ve got the script to make it disappear, but I now want to appear again after the collision. Here is my script so far:
function OnCollisionEnter(theCollision : Collision){
if(theCollision.gameObject.name == "Target"){
Debug.Log("Score!");
Destroy(gameObject, 1);
}
}
The basketball is stored in a prefab so I just need a way of making the prefab instantiate the basketball again. Can anyone help?