Search Unity

bake timeline animation

Discussion in 'Timeline' started by wtetotew, Feb 15, 2021.

  1. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    68
    Hi!

    I have a project with a lot of animation clips in the timeline.

    I was wondering if those animations are in some way "baked"?
    Or is it possible to "bake" them since they are predefined on the timeline.

    Also is it the most efficient way to play animation in term of performance?

    Thanks for your insights.
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Baking all clips on a track to a single clip would not give you significant performance gains, and would slow down iteration/player building.

    There isn't a huge difference between evaluating 1 or 2 clips at a time and having multiple clips on the track, vs always having 1 clip being evaluated.

    And if you are reusing clips between Timelines, it would take up more memory.
     
  3. yokenstein

    yokenstein

    Joined:
    Sep 19, 2017
    Posts:
    84
    I want to merge the clips so they can be exported into an FBX file as 1 clip, into an external program. The reason is, my characters timeline track involves multiple blending between clips, and to re-blend or set them up again in an external program (in the exact manner as in the timeline sequence) won't be possible
     
    pwka and mmozzacat like this.
  4. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    Hello, I have been wondering because animation tracks usually get complex on the editor, for example:
    upload_2023-4-25_11-39-42.png

    So I was wondering if evaluating and having in memory all the animations these clips come from would impact performance and I would consider baking the track into a single animation clip if that could help.

    I appreciate any advise.
     
  5. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    You can always keep and mute the original track then measure the difference. I would not expect it to be noticeable, but you never know for sure without measuring.
     
  6. tsukimi

    tsukimi

    Joined:
    Dec 10, 2014
    Posts:
    80
    I can't think of a simple way to combine 2 curve, and I think that is the hard part. (combination of 2 simple curves may need more keyframe than the sum of the original keyframes to reproduce the same curve, not to mention that the interpolation of two clips is also a curve)

    But hey! Unity already made a baker for everyone for free, and it's called Unity Recorder. Just play your timeline, record it by the Animation Clip Recorder, and it's done! You should definitly try this.
    (There's even a session teaching you how to record timeline into an AnimationClip or other formats, in the above link)

    If you want to handle the recording by script, use GameObjectRecorder class. (I believe it's almost the same as Animation Clip Recorder)
     
    Last edited: Apr 26, 2023
    Hazneliel likes this.