Lazy eval and performance.

Looking into the doc I couldn’t find this info (not that it ever stopped me asking innane questions).

In my game I’m considering playing a skeleton animation clip every 10 seconds or so to simulate growth, so every 10 seconds the envelop will be updated. But there are many of these and depending of Unity’s approach I might scrape that idea.
So the question is does unity update stuff on demand or all the time ? ie: will my 100 growing object bog the cpu down 100% of the time or only when the (asynchronous) growth animation is playing?

Cheers.

You can use the “yield” in the Update function

yield WaitForSeconds(10)

Actually, you can’t. :wink: You can use yield in coroutines though. Maybe something like

function Start() {
   while (true) {
      PlaySkeletonAnimation();
      yield WaitForSeconds(10);
   }
}

So, the answer is: “only when the growth animation is playing, not 100% of the time”.

–Eric