Skip to content

Commit

Permalink
[Optimize] sync macro config to scene (cocos#7)
Browse files Browse the repository at this point in the history
* sync cc.macro.BATCHER2D_MEM_INCREMENT to scene

* 同步所有的引擎宏到场景内
  • Loading branch information
yanOO1497 committed Mar 25, 2022
1 parent 5fce0a3 commit d32dd42
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/builtin/scene/source/script/3d/manager/startup/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,20 @@ class EngineStartup {
/**
* 启动引擎前的引擎配置修改
*/
public configureStartup() {
// canvas 透明度修改
public async configureStartup() {
// canvas 透明度修改,在编辑器环境下为了显示游戏 canvas 下的一些编辑器元素需要强制开启宏
cc.macro.ENABLE_TRANSPARENT_CANVAS = false;
// Enable antialias
// 默认开启抗锯齿,可以让编辑器下编辑体验更好一些
cc.macro.ENABLE_WEBGL_ANTIALIAS = true;
const skipMacro = ['ENABLE_TRANSPARENT_CANVAS', 'ENABLE_WEBGL_ANTIALIAS'];
const macroConfig = await Editor.Profile.getConfig('engine', 'macroConfig');
Object.keys(macroConfig).forEach((macroKey) => {
if (skipMacro.includes(macroKey)) {
return;
}
// @ts-ignore
cc.macro[macroKey] = macroConfig[macroKey];
})
}

/**
Expand Down

0 comments on commit d32dd42

Please sign in to comment.