How to replace prefab at the same location?

Hi everyone,

I am trying to make a tree that grows every ten seconds. I made 4 prefabs (germ, small, medium and big) and I want the object to change every 10 seconds. I manage to make the timer work, but i don’t know how to replace PlantStage01 with PlantStage02. I tried with instantiate but it seems like I’m doing something wrong.

using UnityEngine;
using System.Collections;

public class PlantGrowth : MonoBehaviour 

	public float plantGrowth = 1;
	public float plantSize;
	void Start () {

	void Update () {
		plantSize = plantSize + plantGrowth * Time.deltaTime;

		if (plantSize>=10)
			Destroy (gameObject);	
			Instantiate (Resources.Load ("Prefabs/PlantStage02"));


All I achieve is that it keep creating PlantStage02 every frame until the gameObject is destroyed, then the script is destroyed with it, and nothing happens anymore. What I want is for the prefab PlantStage01 to disappear and be replaced by PlantStage02.

Can anybody help?

Thank you

I’m going to assume that PlantGrowth is a script that is on PlantStage01

So when you Instantiate your PlantStage02, simply pass the position of PlantStage01

Instantiate (Resources.Load ("Prefabs/PlantStage02"), this.transform.position, this.transform.rotation);