diff --git a/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs index 193fd4d86..d2d362b84 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineGroupFramingEditor.cs @@ -82,14 +82,14 @@ public override VisualElement CreateInspectorGUI() return ux; } - protected virtual void OnGuiHandler() + protected virtual void OnGuiHandler(CinemachineBrain brain) { if (Target == null || !CinemachineCorePrefs.ShowInGameGuides.Value || !Target.isActiveAndEnabled) return; var vcam = Target.ComponentOwner; - var brain = CinemachineCore.FindPotentialTargetBrain(vcam); - if (brain == null || !brain.IsLiveChild(vcam) || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) + if (brain == null || brain != CinemachineCore.FindPotentialTargetBrain(vcam) + || !brain.IsLiveChild(vcam) || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) return; var group = vcam.LookAtTargetAsGroup; diff --git a/com.unity.cinemachine/Editor/Editors/CinemachineHardLookAtEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineHardLookAtEditor.cs index a809cc9b1..20678664c 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachineHardLookAtEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineHardLookAtEditor.cs @@ -25,15 +25,15 @@ protected virtual void OnDisable() InspectorUtility.RepaintGameView(); } - protected virtual void OnGuiHandler() + protected virtual void OnGuiHandler(CinemachineBrain brain) { // Draw the camera guides if (Target == null || !CinemachineCorePrefs.ShowInGameGuides.Value || !Target.isActiveAndEnabled) return; var vcam = Target.VirtualCamera; - var brain = CinemachineCore.FindPotentialTargetBrain(vcam); - if (brain == null || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) + if (brain == null || brain != CinemachineCore.FindPotentialTargetBrain(vcam) + || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) return; bool isLive = targets.Length <= 1 && brain.IsLiveChild(vcam, true); diff --git a/com.unity.cinemachine/Editor/Editors/CinemachinePositionComposerEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachinePositionComposerEditor.cs index 43827a05c..4cb15314e 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachinePositionComposerEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachinePositionComposerEditor.cs @@ -33,14 +33,14 @@ protected virtual void OnDisable() InspectorUtility.RepaintGameView(); } - protected virtual void OnGuiHandler() + protected virtual void OnGuiHandler(CinemachineBrain brain) { if (Target == null || !CinemachineCorePrefs.ShowInGameGuides.Value || !Target.isActiveAndEnabled) return; var vcam = Target.VirtualCamera; - var brain = CinemachineCore.FindPotentialTargetBrain(vcam); - if (brain == null || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) + if (brain == null || brain != CinemachineCore.FindPotentialTargetBrain(vcam) + || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) return; // Screen guides diff --git a/com.unity.cinemachine/Editor/Editors/CinemachineRotationComposerEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineRotationComposerEditor.cs index 7b6f2070c..ab68743cb 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachineRotationComposerEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineRotationComposerEditor.cs @@ -33,15 +33,15 @@ protected virtual void OnDisable() InspectorUtility.RepaintGameView(); } - protected virtual void OnGuiHandler() + protected virtual void OnGuiHandler(CinemachineBrain brain) { // Draw the camera guides if (Target == null || !CinemachineCorePrefs.ShowInGameGuides.Value || !Target.isActiveAndEnabled) return; var vcam = Target.VirtualCamera; - var brain = CinemachineCore.FindPotentialTargetBrain(vcam); - if (brain == null || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) + if (brain == null || brain != CinemachineCore.FindPotentialTargetBrain(vcam) + || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) return; // Screen guides diff --git a/com.unity.cinemachine/Editor/Obsolete/CinemachineComposerEditor.cs b/com.unity.cinemachine/Editor/Obsolete/CinemachineComposerEditor.cs index 00e63f805..e8616f678 100644 --- a/com.unity.cinemachine/Editor/Obsolete/CinemachineComposerEditor.cs +++ b/com.unity.cinemachine/Editor/Obsolete/CinemachineComposerEditor.cs @@ -46,7 +46,7 @@ public override void OnInspectorGUI() DrawRemainingPropertiesInInspector(); } - protected virtual void OnGuiHandler() + protected virtual void OnGuiHandler(CinemachineBrain brain) { // Draw the camera guides if (Target == null || !CinemachineCorePrefs.ShowInGameGuides.Value) @@ -57,8 +57,8 @@ protected virtual void OnGuiHandler() return; var vcam = Target.VirtualCamera; - var brain = CinemachineCore.FindPotentialTargetBrain(vcam); - if (brain == null || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) + if (brain == null || brain != CinemachineCore.FindPotentialTargetBrain(vcam) + || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) return; // Screen guides diff --git a/com.unity.cinemachine/Editor/Obsolete/CinemachineFramingTransposerEditor.cs b/com.unity.cinemachine/Editor/Obsolete/CinemachineFramingTransposerEditor.cs index 425b69b07..5807c9933 100644 --- a/com.unity.cinemachine/Editor/Obsolete/CinemachineFramingTransposerEditor.cs +++ b/com.unity.cinemachine/Editor/Obsolete/CinemachineFramingTransposerEditor.cs @@ -114,7 +114,7 @@ public override void OnInspectorGUI() DrawRemainingPropertiesInInspector(); } - protected virtual void OnGuiHandler() + protected virtual void OnGuiHandler(CinemachineBrain brain) { // Draw the camera guides if (Target == null || !CinemachineCorePrefs.ShowInGameGuides.Value) @@ -125,8 +125,8 @@ protected virtual void OnGuiHandler() return; var vcam = Target.VirtualCamera; - var brain = CinemachineCore.FindPotentialTargetBrain(vcam); - if (brain == null || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) + if (brain == null || brain != CinemachineCore.FindPotentialTargetBrain(vcam) + || (brain.OutputCamera.activeTexture != null && CinemachineBrain.ActiveBrainCount > 1)) return; // Screen guides diff --git a/com.unity.cinemachine/Runtime/Behaviours/CinemachineBrain.cs b/com.unity.cinemachine/Runtime/Behaviours/CinemachineBrain.cs index 82856b802..f4a80b576 100644 --- a/com.unity.cinemachine/Runtime/Behaviours/CinemachineBrain.cs +++ b/com.unity.cinemachine/Runtime/Behaviours/CinemachineBrain.cs @@ -307,9 +307,9 @@ void OnPreCull() } #if CINEMACHINE_UIELEMENTS - void OnGuiHandler() + void OnGuiHandler(CinemachineBrain brain) { - if (!ShowDebugText) + if (!ShowDebugText || brain != this) return; m_DebugText ??= new DebugText(OutputCamera); diff --git a/com.unity.cinemachine/Runtime/Debug/CinemachineDebug.cs b/com.unity.cinemachine/Runtime/Debug/CinemachineDebug.cs index 216f1e433..40f05ff56 100644 --- a/com.unity.cinemachine/Runtime/Debug/CinemachineDebug.cs +++ b/com.unity.cinemachine/Runtime/Debug/CinemachineDebug.cs @@ -120,7 +120,7 @@ static void PositionWithinCameraView(VisualElement viewportContainer, Camera cam /// Delegate for OnGUI debugging. /// This will be called by the CinemachineDebugDisplay in its OnGUI (editor only) /// - public static Action OnGUIHandlers; + public static Action OnGUIHandlers; /// /// Tracks CinemachineCorePrefs.ShowInGameGuides.Value, so it can be accessed at runtime diff --git a/com.unity.cinemachine/Runtime/Debug/CinemachineDebugDisplay.cs b/com.unity.cinemachine/Runtime/Debug/CinemachineDebugDisplay.cs index c1298bcc3..d1801c960 100644 --- a/com.unity.cinemachine/Runtime/Debug/CinemachineDebugDisplay.cs +++ b/com.unity.cinemachine/Runtime/Debug/CinemachineDebugDisplay.cs @@ -10,10 +10,14 @@ [ExecuteAlways] class CinemachineDebugDisplay : MonoBehaviour { + CinemachineBrain m_Brain; + void OnGUI() { - if (CinemachineDebug.OnGUIHandlers != null && Event.current.type != EventType.Layout) - CinemachineDebug.OnGUIHandlers(); + if (m_Brain == null) + TryGetComponent(out m_Brain); + if (m_Brain != null && CinemachineDebug.OnGUIHandlers != null && Event.current.type != EventType.Layout) + CinemachineDebug.OnGUIHandlers(m_Brain); } } #endif diff --git a/com.unity.cinemachine/Runtime/Debug/CinemachinePanelSettings.asset b/com.unity.cinemachine/Runtime/Debug/CinemachinePanelSettings.asset index e790b1f9f..101cb5193 100644 --- a/com.unity.cinemachine/Runtime/Debug/CinemachinePanelSettings.asset +++ b/com.unity.cinemachine/Runtime/Debug/CinemachinePanelSettings.asset @@ -13,6 +13,7 @@ MonoBehaviour: m_Name: CinemachinePanelSettings m_EditorClassIdentifier: themeUss: {fileID: -4733365628477956816, guid: df9aec944f4474a04847b6d6375e4138, type: 3} + m_DisableNoThemeWarning: 0 m_TargetTexture: {fileID: 0} m_RenderMode: 0 m_WorldSpaceLayer: 0 @@ -41,4 +42,5 @@ MonoBehaviour: m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0} m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0} m_ICUDataAsset: {fileID: 0} + forceGammaRendering: 0 textSettings: {fileID: 0}