Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Key frame animations don't play

Discussion in 'Animation' started by Tixal, Jan 21, 2021.

  1. Tixal


    Mar 9, 2017
    Hi, I have a problem with my key frame animations playback. I control the animations from the code with Invoke methods, the code is very simple and it's basically something like this:

    public void ButtonA_click()
    AnimShake.speed = 1.0f;
    Invoke("StopAnimation", Delay);

    private void StopAnimation()
    AnimShake.speed = 0.0f;

    The Delay length is adjusted to be the half of the animation duration. However there are times when the animation stops playing much earlier than the end of the duration. I've noticed that this is happening mostly when I change the aspect-ratio from the Unity editor. Do you have any ideas what could cause this problem, thanks :)