【Unity】通过AnimatorController更改其中某个动画片断的速度

来源:互联网 发布:淘宝刷单兼职hao360 编辑:程序博客网 时间:2024/05/17 06:54
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;              }          }      } }


0 0
原创粉丝点击