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.
  2. Dismiss Notice

AnimatorControllerPlayable.SetSpeed has no effect on internal AnimationClipPlayable

Discussion in 'Animation' started by Alan-Liu, Apr 9, 2020.

  1. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    When I set the speed of AnimatorControllerPlayable to 0, the internal state is still playing at normal speed(1). It seeems AnimationClipPlayable for the state isn't affectted by parent playable's speed. I tried 2017.4.37f1 and 2019.3.4f1, both have this issue. How can I control the playback speed of the AnimatorControllerPlayable?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Create a float parameter and set it as the speed multiplier of whatever states you want in the Animator Controller.

    Other than that, I don't think you can control the speed. Normally you would use Animator.speed but that doesn't work when using playables.
     
  3. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    Yes, speed multiplier is a solution. But I think there should be a more simpler solution that don't need to modify AnimatorController, like Animator.speed.
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    There should, but Animator Controllers are a stupid system which has dozens of other totally unnecessary limitations like this.
     
    sl1nk3_ubi likes this.
  5. zswad123

    zswad123

    Joined:
    Nov 27, 2019
    Posts:
    2
  6. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    I tried the solution you mentioned, the playback speed of states changed according to the speed multipler, but the transition time (Fixed Duration of the transition set to true) wasn't affectted, which can be affected by Animator.speed.
     
  7. jleemans

    jleemans

    Joined:
    Apr 22, 2020
    Posts:
    19
    Indeed, it appears I had fall in the same trap.
    I use the SetSpeed extension in Unity to change the speed at wich my anim controller as to play, but it dosen't work at all.
    I'd like to have a fix for that.
     
  8. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    Finally, I solve this issue by finding the memory address of "speed" of AnimatorControllerPlayable and modifying it directly.
     
  9. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    Wait, so you're saying that setting the speed normally doesn't work but there is actually an internal speed variable that does work? That's ... dumb.
     
  10. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
    Yes, that speed variable is which Animator.speed actually modified.
     
  11. zaniocz

    zaniocz

    Joined:
    May 9, 2011
    Posts:
    24
    This problem seems fixed in the latest versions