Instantiate Prefab

This is my code to clone the prefab once it is destroyed. It is destroying the prefab at the position where it is destroyed, not its original position. I'm very new at using Unity so what am I missing?

var prefab : Transform;

function OnCollisionEnter () {

Instantiate (prefab, transform.position, transform.rotation);

}

If you save your prefab in the "original position" i.e. move the object to the starting position and then drag it to an empty prefab it'll save its position as well so all you need to do is type:

Instantiate (prefab);

without the position and rotation.

Alternatively if you have several objects with different starting positions you need to specify at run time where you want them to spawn e.g.

var spawnPoint : Vector3;
var prefab : GameObject;

function start(){
   spawnPoint = transform.position;
}

function OnCollisionEnter () {
   Instantiate (prefab, spawnPoint, Quaternion.identity);
}

Quaternion.identity is (0,0,0) rotation