求助官方,急, Creator 2.3.3 打包到 android 以及模拟器运行黑屏进不去游戏, 初步怀疑是加载顺序的问题?

具体错误信息如下:

上面的空是打印的,cc.renderer._forward,, 这个值在后面加载其他的 材质的时候, 表现正常, 为一个非空值。。请教下官方 是否有可能是因为 加载 load quick_compile_project 这个脚本导致出现的问题 , @Knox

补充一下, 这边找到出错的代码在 cc.EffectAsset 的 onLoad 函数中, 在这里面打印信息, Asset 的名称是 builtin-2d-sprite, 是这个材质出错了么? 求助官方

能看到完整的调用栈么

这是完整的日志:

2020-04-24T02:34:32.847Z - normal: Simulator: SCREEN DPI = 96, SCREEN SCALE = 1.00

2020-04-24T02:34:32.848Z - normal: Simulator: WORKAREA WIDTH 1912.00, HEIGHT 989.00

2020-04-24T02:34:32.848Z - normal: Simulator: FRAME SCALE = 0.50

2020-04-24T02:34:33.500Z - normal: Simulator: Ready for GLSL

2020-04-24T02:34:33.500Z - normal: Simulator: Ready for OpenGL 2.0

2020-04-24T02:34:33.500Z - normal: Simulator: Project Config:

2020-04-24T02:34:33.500Z - normal: Simulator: project dir: D:\CocosDashboard_1.0.0\resources.editors\Creator\2.3.3\resources\cocos2d-x\simulator\win32\

2020-04-24T02:34:33.500Z - normal: Simulator: writable path: $(PROJDIR)\

2020-04-24T02:34:33.500Z - normal: Simulator: script file: $(PROJDIR)\main.js

2020-04-24T02:34:33.501Z - normal: Simulator: frame size: 750 x 1334

2020-04-24T02:34:33.501Z - normal: Simulator: frame scale: 0.50

2020-04-24T02:34:33.501Z - normal: Simulator: show console: NO

2020-04-24T02:34:33.501Z - normal: Simulator: write debug log: NO ()

2020-04-24T02:34:33.501Z - normal: Simulator: listen:

2020-04-24T02:34:33.502Z - normal: Simulator: debugger: none

2020-04-24T02:34:33.502Z - normal: Simulator: add searching path:

2020-04-24T02:34:33.502Z - normal: Simulator:

2020-04-24T02:34:33.502Z - normal: Simulator:

2020-04-24T02:34:33.502Z - normal: Simulator:

2020-04-24T02:34:33.502Z - normal: Simulator: resetDesignResolution request

2020-04-24T02:34:33.502Z - normal: Simulator: ------------------------------------------------

2020-04-24T02:34:33.502Z - normal: Simulator: LOAD Js FILE: jsb-adapter/jsb-builtin.js

2020-04-24T02:34:33.502Z - normal: Simulator: ------------------------------------------------

2020-04-24T02:34:33.502Z - normal: Simulator: D/jswrapper (367): Initializing V8, version: 7.5.288.22

2020-04-24T02:34:34.436Z - normal: Simulator: D/jswrapper (813): libuv version: 1.13.1

2020-04-24T02:34:34.438Z - normal: Simulator: D/jswrapper (112): Debugger listening…, visit [ chrome-devtools://devtools/bundled/js_app.html?v8only=true&ws=0.0.0.0:5086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug!

2020-04-24T02:34:34.438Z - normal: Simulator: D/jswrapper (115): For help see https://nodejs.org/en/docs/inspector

2020-04-24T02:34:34.474Z - normal: Simulator: D/jswrapper (130): JS: Enable batch GL commands optimization!

2020-04-24T02:34:34.477Z - normal: Simulator: resetDesignResolution request

2020-04-24T02:34:34.477Z - normal: Simulator: ------------------------------------------------

2020-04-24T02:34:34.477Z - normal: Simulator: LOAD Js FILE: main.js

2020-04-24T02:34:34.477Z - normal: Simulator: ------------------------------------------------

2020-04-24T02:34:34.763Z - normal: Simulator: iShow!

2020-04-24T02:34:34.829Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/71/71bb0a06-573b-42eb-831e-67c9288da0d7.json

2020-04-24T02:34:34.845Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/ec/eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432.json

2020-04-24T02:34:34.847Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/28/2874f8dd-416c-4440-81b7-555975426e93.json

2020-04-24T02:34:34.848Z - normal: Simulator: D/jswrapper (149): JS: uuid: 2874f8dd-416c-4440-81b7-555975426e93

2020-04-24T02:34:34.848Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-2d-sprite null 2874f8dd-416c-4440-81b7-555975426e93

2020-04-24T02:34:34.850Z - error: Simulator: E/jswrapper (272): ERROR: Uncaught TypeError: Cannot read property ‘_programLib’ of null, location: src/cocos2d-jsb.js:0:0
STACK:
[0]onLoad@src/cocos2d-jsb.js:27954
[1]loadUuid@src/cocos2d-jsb.js:44816
[2]Loader.handle@src/cocos2d-jsb.js:43756
[3]flow@src/cocos2d-jsb.js:44289
[4]flow@src/cocos2d-jsb.js:44307
[5]anonymous@src/cocos2d-jsb.js:44297
[6]anonymous@src/cocos2d-jsb.js:42903
[7]queryAssetInfo@src/cocos2d-jsb.js:48841
[8]AssetLoader.handle@src/cocos2d-jsb.js:42874
[9]flow@src/cocos2d-jsb.js:44289
[10]proto.flowIn@src/cocos2d-jsb.js:44364
[11]proto.append@src/cocos2d-jsb.js:43980
[12]proto.flowInDeps@src/cocos2d-jsb.js:42578
[13]loadDepends@src/cocos2d-jsb.js:44710
[14]loadUuid@src/cocos2d-jsb.js:44819
[15]Loader.handle@src/cocos2d-jsb.js:43756
[16]flow@src/cocos2d-jsb.js:44289
[17]flow@src/cocos2d-jsb.js:44307
[18]anonymous@src/cocos2d-jsb.js:44297
[19]anonymous@src/cocos2d-jsb.js:42903
E/jswrapper (563): [ERROR] (f:\jenkins\workspace\creator_2d\cocos2d-x-lite\windows\cocos2d-x-lite\cocos\scripting\js-bindings\jswrapper\v8\object.cpp, 563): Invoking function (0F67EBD8) failed!
at HTMLElement.print-simulator-log (D:\CocosDashboard_1.0.0\resources.editors\Creator\2.3.3\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1608)
at Object.e._dispatch (D:\CocosDashboard_1.0.0\resources.editors\Creator\2.3.3\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1876)
at EventEmitter. (D:\CocosDashboard_1.0.0\resources.editors\Creator\2.3.3\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2952)
at EventEmitter.emit (events.js:194:13)
at EventEmitter.emit (domain.js:469:20)
at EventEmitter.topLevelDomainCallback (domain.js:124:23)
2020-04-24T02:34:34.912Z - normal: Simulator: D/jswrapper (130): JS: load quick_compile_project: 60.65100000000001ms

2020-04-24T02:34:34.931Z - normal: Simulator: D/renderer (616): Device caps: maxVextexTextures: 32, maxFragUniforms: 1024, maxTextureUints: 32, maxVertexAttributes: 16, maxDrawBuffers: 8, maxColorAttatchments: 8

2020-04-24T02:34:34.931Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/14/144c3297-af63-49e8-b8ef-1cfa29b3be28.json

2020-04-24T02:34:34.940Z - normal: Simulator: D/jswrapper (149): JS: uuid: 144c3297-af63-49e8-b8ef-1cfa29b3be28

2020-04-24T02:34:34.940Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-2d-gray-sprite [object Object] 144c3297-af63-49e8-b8ef-1cfa29b3be28

2020-04-24T02:34:34.940Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/0e/0e93aeaa-0b53-4e40-b8e0-6268b4e07bd7.json

2020-04-24T02:34:34.940Z - normal: Simulator: D/jswrapper (149): JS: uuid: 0e93aeaa-0b53-4e40-b8e0-6268b4e07bd7

2020-04-24T02:34:34.940Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-2d-spine [object Object] 0e93aeaa-0b53-4e40-b8e0-6268b4e07bd7

2020-04-24T02:34:34.945Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/82/829a282c-b049-4019-bd38-5ace8d8a6417.json

2020-04-24T02:34:34.947Z - normal: Simulator: D/jswrapper (149): JS: uuid: 829a282c-b049-4019-bd38-5ace8d8a6417

2020-04-24T02:34:34.947Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-3d-particle [object Object] 829a282c-b049-4019-bd38-5ace8d8a6417

2020-04-24T02:34:35.028Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/2a/2a7c0036-e0b3-4fe1-8998-89a54b8a2bec.json

2020-04-24T02:34:35.028Z - normal: Simulator: D/jswrapper (149): JS: uuid: 2a7c0036-e0b3-4fe1-8998-89a54b8a2bec

2020-04-24T02:34:35.029Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-3d-trail [object Object] 2a7c0036-e0b3-4fe1-8998-89a54b8a2bec

2020-04-24T02:34:35.044Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/c0/c0040c95-c57f-49cd-9cbc-12316b73d0d4.json

2020-04-24T02:34:35.044Z - normal: Simulator: D/jswrapper (149): JS: uuid: c0040c95-c57f-49cd-9cbc-12316b73d0d4

2020-04-24T02:34:35.045Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-clear-stencil [object Object] c0040c95-c57f-49cd-9cbc-12316b73d0d4

2020-04-24T02:34:35.046Z - normal: Simulator: D/jswrapper (149): JS: url: F:/works/SwingBlocks/Code/SwingBlock3/library/imports/6d/6d91e591-4ce0-465c-809f-610ec95019c6.json

2020-04-24T02:34:35.047Z - normal: Simulator: D/jswrapper (149): JS: uuid: 6d91e591-4ce0-465c-809f-610ec95019c6

2020-04-24T02:34:35.047Z - normal: Simulator: D/jswrapper (149): JS: cc.EffectAsset: builtin-unlit [object Object] 6d91e591-4ce0-465c-809f-610ec95019c6

2020-04-24T02:34:36.824Z - normal: Simulator: D/jswrapper (455): ScriptEngine::cleanup begin …

2020-04-24T02:34:36.825Z - normal: Simulator: D/jswrapper (594): GC begin …, (js->native map) size: 28, all objects: 220

2020-04-24T02:34:36.854Z - normal: Simulator: D/jswrapper (602): GC end …, (js->native map) size: 27, all objects: 219

2020-04-24T02:34:36.854Z - normal: Simulator: D/jswrapper (594): GC begin …, (js->native map) size: 27, all objects: 219

2020-04-24T02:34:36.870Z - normal: Simulator: D/jswrapper (602): GC end …, (js->native map) size: 27, all objects: 219

2020-04-24T02:34:36.870Z - normal: Simulator: D/jswrapper (594): GC begin …, (js->native map) size: 0, all objects: 0

2020-04-24T02:34:36.895Z - normal: Simulator: D/jswrapper (602): GC end …, (js->native map) size: 0, all objects: 0

2020-04-24T02:34:36.898Z - normal: Simulator: D/jswrapper (516): ScriptEngine::cleanup end …

顺序不太对啊

这个应该在报错之前才对

但是我这边运行确实是在报错之后的, 我在浏览器上面运行,没有报错, load quickcompile_project 确实是在cc.EffectAsset 加载之前运行的, 但是在模拟器上或者是在 手机上, 就不对了。 另外新建了一个项目, 在模拟器上运行,没有报错, 现在这边在测试,新建很多脚本, 延长 load quickcompile_project 的运行时间, 看是否能在空项目上 重现 cc.EffectAsset 加载 运行在 load quickcompile_project 之前

延长 load quickcompile_project 的运行时间, 看是否能在空项目上 重现 cc.EffectAsset 加载 运行在 load quickcompile_project 之前

应该跟脚本数量没关系的,代码里面是加载脚本完成后才进行加载effect资源

得想办法看下错误的effect加载是在什么时候触发的。要在_initEngine之后执行才正常

_initEngine里面会去初始化_forward

我这边再找下 看看怎么触发加载 Effect 的

非常感谢, 找到问题了, 自己代码里面写的问题, 在代码的最外围调用了手动加载资源,导致出现问题,这个应该也属于一个bug吧, 具体代码如下:
`import { BlockInfo } from “…/…/…/Configs/StageConfig”;

const { ccclass, requireComponent } = cc._decorator;
@ccclass
@requireComponent(cc.Sprite)
@requireComponent(cc.RigidBody)
export default class BaseBlock extends cc.Component {
protected static prefab: cc.Prefab = null;

static init() {
	cc.loader.loadRes("Prefabs/" + cc.js.getClassName(this), cc.Prefab, (error: Error, prefab: cc.Prefab) => {
		this.prefab = prefab;
	});
}

}

BaseBlock.init();
`

加载资源不要写在代码最外面,否则会在引擎初始化之前就去加载,导致出现问题。你可以写在onLoad或者start都可以,得保证在引擎初始化之后再加载资源