Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Why does animation jump to start at t=1

Discussion in 'Animation' started by MDADigital, Nov 8, 2020.

  1. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    I need to control the anim frame by frame for a use case in our game. The POC test code looks like

    Code (CSharp):
    1. public class Test : MonoBehaviour
    2. {
    3.     public Animator anim;
    4.  
    5.     [Range(0, 1)]
    6.     public float t;
    7.  
    8.     public void Start()
    9.     {
    10.         anim.speed = 0;
    11.         anim.StopPlayback();
    12.     }
    13.  
    14.     public void Update()
    15.     {
    16.         anim.Play("EjectCasing", -1, t);
    17.        
    18.     }
    19. }
    At T=1 the animation jumps to the first frame
     
  2. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Is this by design or a bug? Seems like a bug?