Search Unity

Problem about exit time of Animator Transition

Discussion in 'Scripting' started by ngqbac, Jan 25, 2019.

  1. ngqbac

    ngqbac

    Joined:
    Jan 8, 2019
    Posts:
    4
    I know exit time can be change in Transition Setting like this pic. But I don't know how to change exit time by script. Can anyone show me how to do it? Here is the transition that I want to change exit time by script. Sorry about my bad English skill.
    upload_2019-1-25_11-28-49.png
    Here is script I try to do but it doesn't work


    Animator _animator = gameObject.GetComponent<Animator>();
    float _exitTime = _animator.GetComponent<AnimatorStateTransition>().exitTime;
     
  2. ngqbac

    ngqbac

    Joined:
    Jan 8, 2019
    Posts:
    4
  3. ngqbac

    ngqbac

    Joined:
    Jan 8, 2019
    Posts:
    4
    I found it finally
    Code (CSharp):
    1. AnimatorController animatorController;
    2. animatorController.layers[layerIndex].stateMachine.states[stateIndex].state.transitions[transitionIndex].exitTime;