diff --git a/Editor/PreviewSystem/Rendering/ProxyObjectController.cs b/Editor/PreviewSystem/Rendering/ProxyObjectController.cs index 5e85daa..b6f3d76 100644 --- a/Editor/PreviewSystem/Rendering/ProxyObjectController.cs +++ b/Editor/PreviewSystem/Rendering/ProxyObjectController.cs @@ -127,6 +127,8 @@ private void SetupRendererMonitoring(Renderer r) OnInvalidate = Task.WhenAny(_monitorRenderer.OnInvalidate, _monitorMaterials.OnInvalidate, _monitorMesh.OnInvalidate); } + private bool _shouldEnable; + internal bool OnPreFrame() { if (_replacementRenderer == null || _originalRenderer == null) @@ -146,8 +148,9 @@ internal bool OnPreFrame() _pickingOffOriginal = SceneVisibilityManager.instance.IsPickingDisabled(original.gameObject); _visibilityOffOriginal = SceneVisibilityManager.instance.IsHidden(original.gameObject); } - - target.enabled = original.enabled && original.gameObject.activeInHierarchy; + + target.enabled = false; + _shouldEnable = original.enabled && original.gameObject.activeInHierarchy; bool shouldDisablePicking = _pickingOffOriginal || _visibilityOffOriginal; @@ -229,7 +232,10 @@ internal bool OnPreFrame() internal void FinishPreFrame(bool isSceneViewCamera) { - if (_replacementRenderer != null) _replacementRenderer.enabled &= !(isSceneViewCamera && _visibilityOffOriginal); + if (_replacementRenderer != null) + { + _replacementRenderer.enabled = _shouldEnable && !(isSceneViewCamera && _visibilityOffOriginal); + } } private void CreateReplacementObject()