Hey I'm trying to instantiate an object but all it seems to do is keep making clones until unity crashes. I only need 3 clones. What am I doing wrong?
void Start ()
{
rotation.x = Random.Range(-0.1600f, -0.2200f);
int startrot = Random.Range(0, 360);
transform.rotation = Quaternion.Euler(startrot, 0, 0);
// Array 0=0 1=1 ... 9=9
for(int i = 0; i < 10; i++)
{
myDegrees[i]=270-(36*i);
Debug.Log("InputArray" + myDegrees[i]);
}
for(int c = 0; c < 3; c++)
{
Instantiate(prefab, new Vector3 (37, 0, 0), Quaternion.identity);//as Transform;
Debug.Log ("c= " + c);
}
}
↧