CCSprite.js:572 Uncaught TypeError: Cannot read property ‘_renderFlag’ of null
at cc_Sprite.markForUpdateRenderData (CCSprite.js:572)
at cc_Sprite.set [as spriteFrame] (CCSprite.js:220)
at cc_DynamicAnimCurve.sample (animation-curves.js:240)
at AnimationState.simpleProcess [as _process] (animation-state.js:312)
at AnimationState.13.proto.update (animation-state.js:349)
at CCClass.update (animation-manager.js:44)
at 32.cc.Scheduler.update (CCScheduler.js:413)
at 27.cc.Director.mainLoop (CCDirector.js:945)
at callback (CCGame.js:639)
是因为node上还有 Action 在运行导致的吗?
我试过先:
node.pauseAllActions();
node.destroy();
还是一样。
是帧动画在跑 不是你的动作 先停帧动画
ani = node.getComponent(cc.Animation);
ani.stop();
node.destroy();
还是一样的错。
有没有可能是动作或者动画的停止没有执行完就执行了destroy的缘故呢
你们说的都对,试到现在,测试了很多方法:
aniState = ani.getAnimationState("…");
aniState.play();
this.scheduleOnce(_=>{
aniState.stop();
},0.1);
我发现直接stop就是不行,先play,延迟0.1秒,再stop好了,感觉好像是一个异步的问题导致的。
感觉官方这个Animation 的接口: play 和 stop有很多奇葩问题。