using UnityEngine;
using System.Collections;
using UnityEditor.Animations;
public class NewBehaviourScript : MonoBehaviour {
public AnimatorController AC;
private float speed = 2f;
void IfNeedChangeSpeed ()
{
AC.layers [0].stateMachine.states [0].state.speed = 5;
for (int i = 0; i < AC.layers [0].stateMachine.states.Length; i++) {
Debug.Log (AC.layers [0].stateMachine.states [i].state.name == "指定的动画名");
if (AC.layers [0].stateMachine.states [i].state.name == "指定的动画名") {
AC.layers [0].stateMachine.states [i].state.speed = speed;
}
}
}
}
【Unity】通过AnimatorController更改其中某个动画片断的速度
最新推荐文章于 2024-04-28 14:39:58 发布