Outside the loop?

Hi there.

I do realise the whole basis of Unity is a cracking, somewhat automated frame rate and fixed physics and all that good stuff.

But, is there a way to break out of this loop and have a code script bang away as fast as possible halting all updates? I’m working on a small project that’s creating 10-50k objects, I’m sure it could run faster if the auto stuff weren’t doing it’s thing.

I don’t at present think it’s a very good candidate for dots due to the amount of data manipulation going on, it’s not just prefabs, it’s a bunch of classes too.

Any ideas?
Thanks.

If you run a method from Update, that method will run until completion. If it takes 50 seconds, then the entire game will hang for 50 seconds.

Background threads will be doing things, but they’ll eventually all stall and wait for the main thread to finish, so you should be good.

1 Like

This is the default behavior of any code that runs in Update (or any Unity callback for that matter).

1 Like

Interesting… Usually the questions like this are the reverse. Someone creating a very large number of something and complaining the game freezes for several seconds while Unity does exactly what it was told :wink:

1 Like