First you need to connect an object to the script. In this example case a Rigidbody object. So save this in a variable.
//Drag the prefab with a rigidbody to the prefab& slot in the inspector
var Rigidbody : prefab;
function Update{
//Now instantiate it.
clone = Instantiate(prefab, transform.position, transform.rotation);
}
//transform.position instantiates the object at the coordinates you set.
//transform.rotation makes the object have the same rotation.
//You can place an empty object and attach this script to it to instantiate inside it but I'm sure there are other ways.
↧