吐槽一个Creator很蛋疼的设计,SpriteFrame。

在Creator中,SpriteFrame可看作一种资源,每一张文理对应一个Texture2D资源,SpriteFrme必须依赖于Texture2D。在释放Texture2D的同时无法保证使用了该纹理的SpriteFrame释放或不进行渲染。 同时官方还移除了SpriteframeCache。这种设计,尤其在使用纹理图集,以及在处理稍微复杂的动画资源的时候很蛋疼。 那些需要手动释放且没用统一接口的SpriteFame,超级恶心。不知官方怎么想的。

顶一个,现在资源释放都找不到一个好的方案

感觉 spriteFrame 是一个兼容web和原生的中间件, 要写个接口要搞多个平台太麻烦,官方偷懒了

CCTexture2D.js源码这下面的代码释放了this._image.src,也不把this._image设置下空,感觉很不负责任,我说了吗:joy:

if (cc.macro.CLEANUP_IMAGE_CACHE && this._image instanceof HTMLImageElement) {
// wechat game platform will cache image parsed data,
// so image will consume much more memory than web, releasing it
this._image.src = “”;
// Release image in loader cache
cc.loader.removeItem(this._image.id);
}

cc.loader.release啊

额 。。没关系吧 置空了不会有问题么? 内存泄露?

关系倒是没关系,只是外面使用不知道_image已经没了,如果是空就知道了。