import { _decorator, Animation, Component, Node } from 'cc'; const { ccclass, property } = _decorator; @ccclass('AnmEndCom') export class AnmEndCom extends Component { start() { if(this.node.getComponent(Animation)){ let anim = this.node.getComponent(Animation); // console.log("has anim",anim) anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this); } } onAnimationFinished(){ this.node.destroy() } }