Cocos Creator v2.4.0-rc.9 测试帖(正式版已发)

好的~感觉解答~:coffee:

太感谢了:pray::pray:

我去掉了 cc.assetManager.bundles.clear();
然后切换场景,出现另外一个错了
在第5次切换场景的时候,出现了这个错。。。

这个错是因为错误释放了复用的资源导致的,你两个场景之间有复用的资源,这种情况下,我不建议你自己去调用releaseAll来释放资源,这样可能释放错,建议你勾上场景的自动释放选项

了解了~
谢谢大佬~

释放SpriteFrame时,没有把关联的texture释放掉, 按照文档描述,在释放spriteFrame时应该会自动删除关联的引用计数为0的texture啊。

cc.assetManager.loadRemote("http://t8.baidu.com/it/u=1484500186,1503043093&fm=79&app=86&f=JPEG?w=1280&h=853",{ext: '.png'}, (err, tex)=>{
                    if (err) {
                        cc.error(err);
                        return;
                    }

                    this.oldSpf = this.bg.spriteFrame;
                    let spf = new cc.SpriteFrame();
                    spf.setTexture(tex);
                    this.bg.spriteFrame = spf;
                    this.tex = tex;
                    this.spf = spf;
                });
// 复原并删除加载的资源
this.bg.spriteFrame = this.oldSpf;
cc.assetManager.releaseAsset(this.spf);
// 释放spriteFrame时并没有释放引用的texture, 虽然this.tex的refCount为0,this.tex仍然可以再次使用
// 如果texture被正确释放了,那下面的代码应该出错的
 let spf = new cc.SpriteFrame();
 spf.setTexture(tex);
 this.bg.spriteFrame = spf;

如果是因为当前帧被渲染过导致的没有被删除,那什么时机这个资源会被释放?如果不处理是不是就泄漏了?我尝试延迟几秒后this.tex仍然没有被释放,延迟调用cc.assetManager.releaseAsset(this.spf)也一样不会释放spf关联的贴图资源。cc.assetManager.releaseAsset(this.tex)则立即生效会释放掉。
####简单流程就是加载一张贴图,使用这个贴图创建一个spriteFrame,然后使用这个spriteFrame,当不再使用这个spriteFrame时,正确的释放方式是什么?只调用cc.assetManager.releaseAsset(spriteFrame)时没有按照文档说的把关联的texture释放掉。

cc.assetManager.releaseAsset(spriteFrame)

这样并不能释放 texture,因为这个 spriteFrame 是动态创建出来的,引擎是没法统计出他的依赖资源的,所以在释放spriteFrame 的时候不会去释放 texture, 这里你只能用 cc.assetManager.releaseAsset(this.spf.getTexture())。

自动释放的前提是,这个资源是引擎加载进来的,这样引擎能统计到他的依赖然后去自动释放

那文档还是描述清楚一点比较好,如果我手动加载图片创建spriteframe,那释放的时候仍然需要查找依赖全部释放的。上面那个例子,如果要释放干净是不是要同时释放贴图和精灵帧?
cc.assetManager.releaseAsset(this.spf.getTexture());
cc.assetManager.releaseAsset(this.spf);

对的,我们完善下文档

莫名其妙所有项目都打不开了,新建项目也打不开。同时开两个项目不知道怎么就报错了,再也恢复不了了。。。
卸载编辑器重新安全恢复正常。

(node:60869) [DEP0106] DeprecationWarning: crypto.createDecipher is deprecated.
/Applications/CocosC…derer/ui/index.js:1 [Deprecation] document.registerElement is deprecated and will be removed in M73, around March 2019. Please use window.customElements.define instead. See https://www.chromestatus.com/features/4642138092470272 for more details.
/Applications/CocosC…elements/utils.js:1 [Deprecation] Element.createShadowRoot is deprecated and will be removed in M73, around March 2019. Please use Element.attachShadow instead. See https://www.chromestatus.com/features/4507242028072960 for more details.
/Applications/CocosC…ld-jsb-adapter.js:1 build jsb-adapter: 3.85498046875ms
CCDebug.js:246 Unknown editor property ‘disallowMultiple’ in class ‘RenderComponent’.
CCDebug.js:246 Unknown editor property ‘disallowMultiple’ in class ‘cc.Widget’.
CCDebug.js:246 Unknown editor property ‘disallowMultiple’ in class ‘cc.Canvas’.
CCDebug.js:246 Unknown editor property ‘disallowMultiple’ in class ‘cc.RigidBody’.
CCDebug.js:246 Unknown editor property ‘disallowMultiple’ in class ‘cc.RigidBody3D’.
CCDebug.js:246 Unknown editor property ‘disallowMultiple’ in class ‘cc.ConstantForce’.
CCDebug.js:246 Please do not specifiy “default” attribute in decorator of “keyFrames” property in “AnimationCurve” class.
Default value must be initialized at their declaration:

// Before:
@property({
type: cc.Integer
default: 0 // <–
})
myProp;
// After:
@property({
type: cc.Integer
})
myProp = 0; // <–
/Applications/CocosC…ils/ccServices.js:1 Cocos Service Version 0.6.4
/Applications/CocosC…tils/operation.js:1 assets-tree._build(): 86.92333984375ms
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/28/2874f8dd-416c-4440-81b7-555975426e93.json?_t=1589537122784 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/30/30682f87-9f0d-4f17-8a44-72863791461b.json?_t=1589537122785 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/14/144c3297-af63-49e8-b8ef-1cfa29b3be28.json?_t=1589537122787 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/0e/0e93aeaa-0b53-4e40-b8e0-6268b4e07bd7.json?_t=1589537122788 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/82/829a282c-b049-4019-bd38-5ace8d8a6417.json?_t=1589537122791 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/60/600301aa-3357-4a10-b086-84f011fa32ba.json?_t=1589537122791 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/2a/2a7c0036-e0b3-4fe1-8998-89a54b8a2bec.json?_t=1589537122793 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/02/0275e94c-56a7-410f-bd1a-fc7483f7d14a.json?_t=1589537122793 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/c0/c0040c95-c57f-49cd-9cbc-12316b73d0d4.json?_t=1589537122796 net::ERR_FILE_NOT_FOUND
download-file.js:74 GET file:///Users/work/cccProjs/NewProject244444/library/imports/6d/6d91e591-4ce0-465c-809f-610ec95019c6.json?_t=1589537122797 net::ERR_FILE_NOT_FOUND

这个问题必现么?

看了下你的工程,实际上跟preload没什么关系,,在web上没有加载bundle,然后launch用到了bundle里的脚本,导致加载场景的时候,实际上没有脚本

那为什么去掉preload就可以了呢?

你可以把script的bundle配置去掉,一样是不行的。

2.4.0 alpha.3 感觉用vscode有点怪怪的,崩溃过一次,要不就是代码定位到cc的api很容易卡住,在等一会就直接没有反应

关注一下:slightly_smiling:

2.4.0 alpha.3 在ide开启的情况下,复制新的spine龙骨文件到资源目录里的时候,在ide里,无法识别出来,必须关掉ide重开一次,才能看见这个文件。

我把 script 的配置去掉,是能切换场景的,

你的具体操作是如何的,能否录制一下视频给我看看?我这边比较好重现

大概在哪个版本会对 x86 64 支持 要2.5、2.6?谷歌上架还是比较需要。。。