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,
- I created a script and calculated object and Camera distance
- Then, apply specific calculations and setup scale settings.
- Remember, all calculations were working per object which means per update. So 1000 updates were running at that time.
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.
0 Comments