-
Creator 版本:2.2.0
-
目标平台: Web,微信小游戏
-
详细报错信息,包含调用堆栈:
CCDebug.js:246 object already destroyed
50.cc.warnID @ CCDebug.js:246
206.prototype.destroy @ CCObject.js:307
destroy @ CCTexture2D.js:618
(anonymous) @ CCClass.js:761
NewClass.UpdateTextureCanvas @ TestSpa.ts:103
NewClass.update @ TestSpa.ts:95
eval @ VM4924:3
(anonymous) @ component-scheduler.js:224
invoke @ component-scheduler.js:189
updatePhase @ component-scheduler.js:495
mainLoop @ CCDirector.js:948
callback @ CCGame.js:643
texture-2d.js:247 WebGL: INVALID_OPERATION: texImage2D: no texture bound to target
_setImage @ texture-2d.js:247
_setMipmap @ texture-2d.js:302
update @ texture-2d.js:107
handleLoadedTexture @ CCTexture2D.js:677
initWithElement @ CCTexture2D.js:532
NewClass.UpdateTextureCanvas @ TestSpa.ts:107
NewClass.update @ TestSpa.ts:96
eval @ VM5458:3
(anonymous) @ component-scheduler.js:224
invoke @ component-scheduler.js:189
updatePhase @ component-scheduler.js:495
mainLoop @ CCDirector.js:948
callback @ CCGame.js:643
callbacks-invoker.js:325 Uncaught TypeError: Cannot read property ‘load’ of null
at cc_Texture2D.213.proto.emit (callbacks-invoker.js:325)
at cc_Texture2D.handleLoadedTexture (CCTexture2D.js:684)
at cc_Texture2D.initWithElement (CCTexture2D.js:532)
at NewClass.UpdateTextureCanvas (TestSpa.ts:107)
at NewClass.update (TestSpa.ts:96)
at eval (eval at createInvokeImpl (component-scheduler.js:219),
65)
at CCClass._invoke (component-scheduler.js:224)
at CCClass.invoke (component-scheduler.js:189)
at CCClass.updatePhase (component-scheduler.js:495)
at 51.cc.Director.mainLoop (CCDirector.js:948)
- 重现方式:
代码:
start() {
this.m_testTexture = new cc.Texture2D();
this.target.spriteFrame.setTexture(this.m_testTexture);
this.m_Canvas = document.createElement(‘canvas’);
}
update(dt: number) {
this.m_testTexture.destroy();
this.m_testTexture.initWithElement(this.m_Canvas);
this.m_testTexture.handleLoadedTexture();
}
- 出现概率:
100%
请问大大怎么处理?
项目需要比较频繁的更新texture