Instantiating an object after destroying one.


I am trying to destroy a target already in my scene and then have another target appear. How would I go about doing this?

My code at the moment is like this

enter code here
var target1 : GameObject;
var target2 : GameObject;
var target3 : GameObject;

function Start()


target2 == null;
target3 == null;

function Update()
      if (target1 == null){
          //target1 =  Instantiate(target2, Vector3(226,0), Quaternion.identity);

Well, what you have to do is before that line where you instantiate the object, you says destroy(NameGameObject);