-
Creator 版本:2.0.8
-
目标平台: 微信小游戏
-
详细报错信息,包含调用堆栈:
(当微信开放域项目中场景内有组件Label,且它的string的值为空时,打包运行微信小游戏就会出现以下错误)
gameThirdScriptError
Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The image argument is a canvas element with a width or height of 0.;at requestAnimationFrame callback function
Error: Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The image argument is a canvas element with a width or height of 0.
at CanvasRenderingContext2D. (http://127.0.0.1:37919/game/subdev/WAGameSubContext.js:1:99953)
at t.lt. (http://127.0.0.1:37919/game/subdev/WAGameSubContext.js:1:100934)
at t.St [as drawImage] (http://127.0.0.1:37919/game/subdev/WAGameSubContext.js:1:100466)
at Object.draw (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:325855)
at r._commitComp (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:322264)
at v.122.g._render (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:396835)
at v.122.g._worldTransform (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:396417)
at v.122.g._children (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:397330)
at v.122.g._worldTransform (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:396417)
at v.122.g._children (http://127.0.0.1:37919/game/wx-open-data-project/cocos2d-js-min.js:1:397330) -
重现方式:
1.新建一个微信小游戏项目gameWx。
2.再建一个与之关联的开放域项目gameWx-open-data-project
3.在gameWx-open-data-project项目中创建一个scene场景
4.在scene场景中添加一个Label组件。该组件的字符串string内容留空
5.构建gameWx微信小游戏,以及gameWx-open-data-project微信开放域
6.打开微信小游戏编辑器,并运行构建的项目。出现错误信息 -
之前哪个版本是正常的 :cocos creator 2.0
-
编辑器操作系统 :Mac
-
编辑器之前是否有其它报错 :无报错
-
出现概率:100%
-
额外线索:
遇到了这个bug, 按大佬的方案解决了
2.0.8 不在更新,你可以在调用上面函数的时候,自己判断下0值