Search Unity

Bug animation.Crossfade behavior has changed between 2017 and 2020.x !

Discussion in 'Animation' started by laurentlavigne, Mar 6, 2021.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    wow that's a new one
    i've been chasing my tail for an hour looking into my code for bugs when it was "just" another unity-special.
    this time it's crossfade, it used to auto rewind an animation (legacy) therefore allowing to replay the same anim over and over again
    in 2020.x no such luck, now legacy keeps the last state and plays from there, which requires some magic tricks

    i'm sure most of you drank the animator kool-aid (and broke a few teeth on the jar :D) so this won't apply but for those dealing with old projects this will be useful info.
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    You might be interested in Animancer (link in my signature). The Playing and Fading example shows my solution to this problem, which is basically to just have it create another state to play the same animation when necessary so that the old state can fade out while the new state fades in.

    I never really did much with animations in the Legacy system so I don't know how easy it would be to achieve the same thing there, but I believe it does allow you to add animations at runtime so I would assume it's at least possible.
     
    laurentlavigne likes this.
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    I ended up sprinkling Rewind and it worked.
    Animancer is increasingly seductive as a layer of sanity, if I end up converting to animator I'll use it.