Unity optimization tips & tricks: Foreach, the Vampire loop

Foreach, the Vampire loop This is part 1 out of a 2-part series on foreach loops. Click here for part 2. What makes code tick? Make code run fast often seems like mysterious, voodoo-like dark magic. But in reality, by using simple tools and our brain we can get you quite far. So today, we’re gonna cover the surprising amount of impact your foreach loops can have on code execution speed. Under the hood Picture this: you’re working on a large array of AI data for your latest game, but the performance just isn’t there, no matter how simple you try to keep the functions. So you start profiling your code to see what’s wrong. As you go deeper and Read more about Unity optimization tips & tricks: Foreach, the Vampire loop[…]