Search Unity

Animator: Change at runtime speed of animation clip in specific Layer

Discussion in 'Animation' started by sysmaya, Jun 9, 2019.

  1. sysmaya

    sysmaya

    Joined:
    Nov 30, 2013
    Posts:
    14
    How to change the speed of an animation clip. within a specific layer.
    After hours of research and testing.

    Code (CSharp):
    1. AnimatorController ac= animatorruntimeAnimatorController as AnimatorController;
    2. ac.layers [1].stateMachine.defaultState.speed = 3f;
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    513