Undo a destroy command (c#)

Hello everybody,

I’m working on a puzzle game where you control a ball and you have a limited time to reach a certain point. If you reach a green dot you get a 10secs bonus. I’m very new to unity.

What I have done : when the ball reaches the green dot, the green dot disappears (with Destroy) and 10 secs are added to the timer.

My problem is : when the timer reaches 0 there’s a “Restart” button appearing that puts everything the way it was at the beginning of the game.

My question is : how do I undo the destruction of my green dot, so it comes back the way it was ?

A sample of my code :

	void OnCollisionEnter(Collision collisionBonusMalus){
					
		if (collisionBonusMalus.collider.gameObject.tag == "bonus"){
			timeLeft = timeLeft + 10;
			Destroy (collisionBonusMalus.collider.gameObject); 
			}

	}
	
	
	void OnGUI() {
		
		
		
		if (timeLeft<0)
		{
			if (GUI.Button (new Rect(Screen.width-largeurButton,Screen.height-largeurButton,largeurButton,largeurButton),textRestart)){
				//Retour à la position initiale	
				timeLeft = totalTime;
				transform.position=positionOrigine;

				
			}

Moreover I think I’m actually destroying the collision instead of the green dot itself… But I don’t how to do it (in Unity I have a green sphere tagged “bonus”).

Thanks for your help!

Try

void OnCollisionEnter(Collision collisionBonusMalus){
 
  if (collisionBonusMalus.collider.gameObject.tag == "bonus"){
    timeLeft = timeLeft + 10;
    collisionBonusMalus.collider.gameObject.SetActive(false)
  }
 
}

If you want to make things easier for the reset, for everything you de-active in an array, then loop over it and go .SetActive(true) on every one of them.