Hey
I have a question regarding the performance of the "tk2DSpriteAnimator.LateUpdate()" function. My game is experiencing considerable lag at times, and when viewing it through the Profiler, the biggest culprit is tk2dSpriteAnimator.LateUpdate(). For a single frame in one of the worst instances, it is getting 585 calls and its Time is 35.68ms.
In the game, I have "obstacles" that are made up of 2 tk2dSprites and 2 tk2dClippedSprites, each with the same animator (though I'm using 2 different clips for the 4 objects). These objects are rings with a background and border. The player object passes through the rings, so I needed to use two objects to create the back background & border, and then 2 more objects to create the front mask background & border. There is a parent empty game object for each obstacle that contains the 4 children. The parent game object has a box collider, but none of the 4 animating children do.
The reason why I'm separating the background and borders into separate objects is so I can change their colors independently (I'm using 9 colors total). I could simply create assets for each color, but then that would multiply the assets 9x, and then I'd have to have 9 animations instead of 1, so I figured it was more efficient having more game objects.
Anyways, that's my set up. I have 100 of these obstacles total in the scene, but at any given time only 4-8 are present on screen. I tried creating a script that would run through all the obstacles in a foreach loop every second that disables any objects left or right of the screen, but it creates a noticeable stutter each time that Coroutine runs.
Any tips to optimize this? Not sure if I'm approaching this problem the wrong way.
Thanks!