- Home /
Reduce Lag When Loading Multiple Animations
I'm working on a 2D top down infinite terrain game. The game updates the terrain when the player leaves a chunk and keeps just enough loaded to fill the camera view. I've optimized the code so that there is barely a hiccup when reloading new chunks, however, when I added animation to the trees, there's now a several second freeze when reloading. At first, I thought this was due to the overhead of creating all the animators, but even recycling already instanced objects to be used for new chunks doesn't help. There seems to be a large lag spike every time the animators try to start or restart. Has anyone experienced this before?
I'm new to animations so I probably have it set up wrong, but each tree has it's own gameobject, cloned from a prefab that has its own animator and animation. Hopefully, I'm just doing something stupid and it's an obvious fix.
Thanks!