Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Sprite Animation Plays At Different Speed to Transform Recorded Animation

Discussion in 'Animation' started by DotArt, Feb 18, 2023.

  1. DotArt


    Jun 12, 2021
    Hey, so i'm working with 2d sprites and i have a loop animation, for the body and the head i have it animated and exported as a png sequence, for the mouth however i have had to animate the position of it within unity so i can have a child object with the mouths switch out to lip sync for it while the mouth still moves with the body and head.

    I have gone through and positioned the mouth in the right position for each key frame of the original animation so it should sync with the head. (Just for reference the keyframes were 0,4,8,12,16 with 16 being the starting frame so cut from the final animation)

    So i made this, created a key frame at frame 15 of the mouth transform animation and then deleted key frame 16 so it will loop.

    Both Animation clip with the sprites ad animation clip with the transform keyframes go from frame 0-15 however when i play the animation the mouth starts off for the first loop in sync then becomes out of sync to different degrees so i think it must be playing at a different speed or there is an extra from somewhere thats causing it to be slightly longer or shorter
  2. Unrighteouss


    Apr 24, 2018
    I'm not 100% sure what you're trying to do, but if you need the mouth to be perfectly in sync with the body/head, and both animations are the exact same length, then it would likely be much easier to simply animate them together.

    Create an empty parent object -> Add both the head and mouth as children -> Attach an Animator component to the parent -> Animate both head and mouth together.

    It'll be impossible for them to desync this way.

    If you need the mouth to track where the head is, but the mouth frames are a different animation length, then I would still animate the transform position of the mouth with the body, but animate the frames of the mouth using a different layer on the same Animator.

    Hopefully that makes sense, please clarify if I've misunderstood.