a是animatorController组件
获取Clip
a.runtimeAnimatorController.animationClips
删除animationClips[0]所有的Event;
a.runtimeAnimatorController.animationClips[0].events = new AnimationEvent[0] ;
添加事件
AnimationEvent e = new AnimationEvent ();
e.time = 2;
e.functionName = "aaaaaaaaaaaa";
a.runtimeAnimatorController.animationClips[0].AddEvent(e);
替换动画
AnimatorOverrideController overrideController = new AnimatorOverrideController();
overrideController.runtimeAnimatorController = a.runtimeAnimatorController;
overrideController["老的动画名称"] = 新的动画片段;
a.runtimeAnimatorController = overrideController;
//另Animator窗口的State的属性中有(inspect面板)WriteDefaut的对勾取消掉的话,播下一段动画时,已播的动画不会被重置
时间: 2024-10-01 21:56:07