diff --git a/cocos/3d/framework/directional-light-component.ts b/cocos/3d/framework/directional-light-component.ts index 7b35d9d8a6..b2e7e3a65a 100644 --- a/cocos/3d/framework/directional-light-component.ts +++ b/cocos/3d/framework/directional-light-component.ts @@ -53,6 +53,13 @@ export class DirectionalLightComponent extends LightComponent { if (this._light) { this._light.illuminance = this._illuminance; } } + public onLoad () { + if (!this._enabled) { + if (!this.node.scene) { return; } + this._getRenderScene().mainLight.enabled = false; + } + } + protected _createLight (scene?: RenderScene) { if (!this.node.scene) { return; } if (!scene) { scene = this._getRenderScene(); } diff --git a/cocos/core/root.ts b/cocos/core/root.ts index 21fb54d06b..baf7a93dd6 100644 --- a/cocos/core/root.ts +++ b/cocos/core/root.ts @@ -176,7 +176,7 @@ export class Root { } for (const view of this._views) { - if (view.isEnable && view.window === this._mainWindow) { + if (view.isEnable && view.window === this._curWindow) { this._pipeline!.render(view); } } diff --git a/cocos/renderer/scene/camera.ts b/cocos/renderer/scene/camera.ts index 8f1b91d849..9a2482baf5 100644 --- a/cocos/renderer/scene/camera.ts +++ b/cocos/renderer/scene/camera.ts @@ -240,6 +240,7 @@ export class Camera { set enabled (val) { this._enabled = val; + this._view.enable(val); } get enabled () {