Im creating a number of birds in my scene and then im attaching ‘bird’ script to them, the problem is, that everytime I run the game, the script is added to the prefab again, is there anyway to stop a huge build up of scripts being added to the prefab?
var prefab : GameObject;
var numberOfBirds :int;
var i : int;
function Start () {
//Create a target for the birds.
//Create Birds.
while( i < numberOfBirds) {
var position = Vector3(Random.Range(-10, 100), 3, Random.Range(-10, 100));
Instantiate(prefab, position, Quaternion.identity);
i++;
prefab.AddComponent ("bird");
}
}