Search Unity

Question Animation on newly enabled prefab delays playing by one frame

Discussion in 'Animation' started by sbsmith, Jul 16, 2021.

  1. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    We have a prefab with an animator. The positions of the animated objects in the prefab are different than the first frame of their animation. The game object starts disabled in the hierarchy. If I enable the game object in code, immediately tell the director to play the timeline, I see one frame of the objects in the wrong position instead of in the position they should be on the first frame of the animation.
     
  2. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    Is this not the correct forum for this type of question?
     
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    There was a bug back in Unity 2017 where animations played with the Playables API (which is what Timeline is based on) didn't take effect on the first frame after they were created/enabled, but I haven't seen the issue since then.

    I don't know of a solution (other than not using an effected version of Unity), but you can report a bug via the Help menu.
     
  4. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    Our animator found a manual workaround by just placing all the elements at their correct starting positions before the timeline executes. We will try to make a repro project later if we can.