From 0e05b888a6b89a73b63c734e9116583205dd393c Mon Sep 17 00:00:00 2001 From: "zhiming.wu" Date: Mon, 2 Dec 2024 16:17:47 +0800 Subject: [PATCH] fix bug when set targetTexture at game view window --- cocos/misc/camera-component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/misc/camera-component.ts b/cocos/misc/camera-component.ts index c7275fbe358..133849a8d47 100644 --- a/cocos/misc/camera-component.ts +++ b/cocos/misc/camera-component.ts @@ -23,7 +23,7 @@ THE SOFTWARE. */ -import { EDITOR } from 'internal:constants'; +import { EDITOR_NOT_IN_PREVIEW } from 'internal:constants'; import { ccclass, help, executeInEditMode, menu, tooltip, displayOrder, type, serializable, visible, range, rangeMin } from 'cc.decorator'; import { RenderTexture } from '../asset/assets/render-texture'; import { UITransform } from '../2d/framework'; @@ -497,7 +497,7 @@ export class Camera extends Component { this._updateTargetTexture(); if (!value && this._camera) { - this._camera.changeTargetWindow(EDITOR ? (cclegacy.director.root as Root).tempWindow : null); + this._camera.changeTargetWindow(EDITOR_NOT_IN_PREVIEW ? (cclegacy.director.root as Root).tempWindow : null); this._camera.isWindowSize = true; } this.node.emit(CameraEvent.TARGET_TEXTURE_CHANGE, this);