From 3a246bd4dad592bfaa94465459d13d5280b5dab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=A3=AE=E6=96=8C?= Date: Fri, 29 Nov 2019 13:52:38 +0800 Subject: [PATCH] =?UTF-8?q?cc.game.run=20=E5=8C=85=E6=8B=AC=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=20renderpipeline=20(#5798)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos/core/game.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/cocos/core/game.ts b/cocos/core/game.ts index 03b434704a..8735ac2a13 100644 --- a/cocos/core/game.ts +++ b/cocos/core/game.ts @@ -492,13 +492,26 @@ export class Game extends EventTarget { this._initConfig(config); this._initRenderer(); - this.onStart = onStart; + // load renderpipeline + cc.loader.load({ uuid: config.renderpipeline }, (err, asset) => { + // failed load renderPipeline + if (err || !(asset instanceof cc.RenderPipeline)) { + console.error(`Failed load renderpipeline: ${config.renderpipeline}`); + console.error(err); - if (!CC_EDITOR && CC_WECHATGAME/* && !CC_PREVIEW*/) { - SplashScreen.instance.main(this._gfxDevice as any); - } + cc.game.setRenderPipeline(null); + } else { + cc.game.setRenderPipeline(asset); + } - this.prepare(cc.game.onStart && cc.game.onStart.bind(cc.game)); + this.onStart = onStart; + + if (!CC_EDITOR && CC_WECHATGAME/* && !CC_PREVIEW*/) { + SplashScreen.instance.main(this._gfxDevice as any); + } + + this.prepare(cc.game.onStart && cc.game.onStart.bind(cc.game)); + }); } // @ Persist root node section