Hi,
I’m brand new to Unity and really loving in. Fantastic platform!
I do have a very newbish question here, and it’s related to how Update is called per frame. Basically I have a simple for loop to do some testing, and within this loop I spawn a prefab. However I am noticing that each iteration of the loop seems to get called every other frame, which seems odd to me. Here is the simple code:
// Update is called once per frame
void Update () {
if(spawnObjects)
{
for(int n=0;n<10;n++)
{
SpawnIt("Hello " + n.ToString());
Debug.Log("Called " + n.ToString());
n++;
}
spawnObjects =false;
}
}
What gets printed to the log is:
etc.
I rather expected it would be “Called 0, Called 1, Called 2”.
What am I missing here?
Thanks!