How can I destroy objects and instantiates new in Array?

Hi All Unities, How can I destroy objects and instantiates new in Array? Please help!

var Speech:GameObject[];

function Start () {
    Instantiate(Speech[0], transform.position, transform.rotation);
}

function Update(){
    if(Input.GetMouseButtonDown(0)){
        Instantiate(Speech[1], transform.position, transform.rotation);

    }

}


Not quite sure what you are asking, but if it's 'How can I destroy these object I instantiate like this?' then you would assign the return of 'Instantiate' to some variable (probably another array). Then destroying the array, or destroying elements in the array, would destroy those objects.

Hello unity4dNoob,

Can you use Speech[0]'s object again? If you use Speech[0]'s object again You should appoint Speech[0]'s object to an interim value. Else you are requests access to Speech[0]'s object again. You can not access to deleted objects.

If you not use Speech[0]'s object. You can destroy easly with this code

var Speech : GameObject[];
function Update () {
   if(Input.GetMouseButtonDown(0)){
    Destroy(Speech[0].gameObject);
   }
}

Regards Grcan