AutoDestroy.ts 360 B

1234567891011121314151617181920
  1. import { Component,_decorator } from "cc";
  2. const { ccclass, property } = _decorator;
  3. @ccclass
  4. export class AutoDestroy extends Component{
  5. DelayTime =1.5;
  6. // LIFE-CYCLE CALLBACKS:
  7. // onLoad () {},
  8. onLoad () {
  9. this.scheduleOnce(()=>{
  10. this.node.destroy();
  11. },this.DelayTime);
  12. }
  13. // update (dt) {},
  14. };