animation是有事件可以知道动画结束的。请问AnimationController要怎么监听一个状态节点结束呢?
this.animation.on(Animation.EventType.STOP, this.onAnimationStop, this);
animation是有事件可以知道动画结束的。请问AnimationController要怎么监听一个状态节点结束呢?
this.animation.on(Animation.EventType.STOP, this.onAnimationStop, this);
顶一个,有大佬知道吗。
使用StateMachineComponent即可。他会有事件通知的。
有没有简单的一点的方法,只是想知道状态节点结束,就需要创建一个StateMachineComponent脚本,然后去挂在每个状态上。
你可以定时器标记,
你好,如上面的朋友所述,需要要挂载 animation.StateMachineComponent
。如果要实现类似的功能,你可以只创建一个 StateMachineComponent
,然后给所有状态都挂它。例如:
import { animation, _decorator } from 'cc';
const { ccclass, property } = _decorator;
@ccclass
class Notify extends animation.AnimationController {
@property
id = ''; // 这个状态你给它的 ID,供接收方判别
onMotionStateExit(controller: animation.AnimationController) {
controller.node.getComponent(/* 接收事件的组件 */)?.emit(id);
}
}
目前animation.StateMachineComponent只能挂一个,如果我都挂一个,那其他需要的功能就挂不了,而且我只是想要知道状态进出而已,需要到编辑器里面挂animation.StateMachineComponent,怎么都觉得没有animation的事件监听来得方便。
怎么批量修改uuid并且不会出现场景资源丢失?