When I manually add the script
var degrees = 20;
function Update() {
transform.RotateAround (Vector3.zero, Vector3.up, degrees * Time.deltaTime);
}
to the prefab itself I can get the rotation to work. However, when I try and add the rotation inside this prefab creation script I can not get it to work. Moreover, would this have to be inside a update function or how would I get it working all the time?
Essentially what I am trying to do is to slow the rotation as prefab are plotted further away from a given origin. Any help would be greatly appreciated.
var planetPrefab: GameObject;
function Start() {
j = 10;
while (j < 100) {
var cloneplanet: GameObject;
if (planet_class <=100) {
cloneplanet = Instantiate(planetPrefab, Vector3(sx, sy , sz + j), Quaternion.identity);
// I want to modify the 'degrees' variable of the script attached to 'cloneplanet' here!
j = j + 5;
}
}
}