1000 updates method Vs 1 update in unity3d

 If you came across a situation where you have to choose 1000 update methods Vs 1 update method. Then, which option you will choose? My recent findings suggest that always choose 1 update method for better performance.

Recently in one of my unity projects, I have to Scale Down/Up 1000 objects based on camera distance. So, for this reason,

  1. I created a script and calculated object and Camera distance
  2. Then, apply specific calculations and setup scale settings.
  3. Remember, all calculations were working per object which means per update. So 1000 updates were running at that time.
Then, I saw a significant performance drop. As I have mentioned, 3000 objects all are running the update and scaling up Down the object. 

This performance issue has urged me to do a test that significantly enhanced my performance and with the same behavior with low-performance overhead.

Instead of per object per update event, I get all object references in a loop and perform the same calculation in the loop but in a single update. 

Post a Comment

0 Comments