akbiggs / UnityTimer

Powerful and convenient library for running actions after a delay in Unity3D.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimize GC in Unity5.4.4

DavidSheh opened this issue · comments

I found 40B GC in UpdateAllTimers() function of TimerManager class that was caused by foreach and my unity version is 5.4.4. However, all the lower versions have this issue as to my knowlege.
Before optimize:

foreach (Timer timer in this._timers)
{
      timer.Update();
}

After optimize

for (int i = 0; i < this._timers.Count; i++)
{
     this._timers[i].Update();
}

Sorry for the incredibly, incredibly slow response. According to https://jacksondunstan.com/articles/3805 this should no longer be an issue after Unity 5.6.