Unity Community


Results 1 to 4 of 4

  1. Location
    Paris
    Posts
    3,730

    [Tip] Faster animationClips loading time

    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.


  2. Location
    Seoul, Korea
    Posts
    97
    Why this improves a loading time?

    -Kim


  3. Location
    Paris
    Posts
    3,730
    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.


  4. Location
    Seoul, Korea
    Posts
    97
    Thank you for the answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •