Unity Community |

Hello,
just a tip sharing from what I discovered lately :
Loading animationClips with animation.AddClip() loads faster than putting them directly in the prefab.
Also, the context of this should be noticed :
- This is for animated characters with a lot animated bones (40 bones per char, 2 chars on screen)
- Each character has more than 500 animationclips
- The only animationClips I'm injecting with AddClip are common animations between characters, not specific ones.
- Tested on a Galaxy S (Android)
What I did before :
1) put all the animationClips in each character prefab, even the ones that are being re-used between different characters
2) just load the prefab at level initialization
What I do now :
1) just put animationClips that could not be shared between characters in the prefabs
1) Cache all my "universal" animationClips to inject in a AnimationClip[] array at game launch
2) Each time a character is loaded, I inject it these animationClips with a simple foreach() + AddClip
Loading time of a full level on a Galaxy S before : 30+ seconds
After : 15 seconds
(n.b : my FBX keyframes are not yet fully pre-reduced, so it can be even faster after some work)
Last edited by n0mad; 02-17-2011 at 02:07 AM.
Kinetic Damage, a 4 years long fighting game project : Official Trailer,
Official Site : www.kineticdamage.com, Facebook page (blog, articles, dev updates).
Dev Blog : Giant thread (+ additional tips & techniques)
Why this improves a loading time?
-Kim
Hi,
This is a pretty old thread, I don't know if Unity optimized their animation RebuildInternalState yet, but this still seems to be faster.
Also, for the second part of the tip : it's better to Resources.load once all the common clips between gameObjects, and then distribute them with AddClip(), rather than loading them multiple times by putting common ones in each prefab.
You just merge all the prefab common loads with that method.
Kinetic Damage, a 4 years long fighting game project : Official Trailer,
Official Site : www.kineticdamage.com, Facebook page (blog, articles, dev updates).
Dev Blog : Giant thread (+ additional tips & techniques)
Thank you for the answer.