- Home /
Can an animated object become static again?
I have a game with many blocks, which animate as they appear on the screen. It's a simple animation, just scale from 0 to 1. Before I implement the animation I had no problem with draw calls - they were 3-4.
However after I implemented the animation the draw calls count equals the number of visible cubes on the screen, which would be between 500 and 1000.
The cubes animate their scale from 0 to 1 for less than a second, after that they are completely static, but the draw calls don't drop. My question is - can I tell Unity that this object will not be animated any more so it doesn't need any extra draw calls?
Thanks!
No Unity does static batching to all static objects that is it combines all objects into one so even if you unchecked static batching and make the cubes as static once they are animated it wont be much help as it would take more memmory to recalculate it as static
Answer by RemoteBrainSoft · Jul 02, 2014 at 12:09 AM
Static batches are created in the editor before the project is played (see http://docs.unity3d.com/Manual/DrawCallBatching.html). This means you can't create a static batch while the project is running.
If your cubes vertices are simple enough (again, see http://docs.unity3d.com/Manual/DrawCallBatching.html), Unity will create a dynamic batch for you (even after the animation is over).
More advanced options include the use of skinning to get all the cubes drawn in less calls. You will need to have a separate bone for each cube and combine the cubes meshes.
If all the cubes use the same scale, another option is to scale the cubes in the shader instead of the GameObjects transform.
Hope this helps
Good info in general, but doesn't answer my question :/ Thanks
Hi The answer is no you cant change it to static but you can play around with culling layers
Anyways what shader are the cubes using and what are you trying to achieve (1000 boxes are pretty large) Please give us a better info so that we can help you