From b82cc621866debbe2c7337c016fc83261dc27635 Mon Sep 17 00:00:00 2001 From: originalnicodr Date: Wed, 26 Feb 2025 00:45:15 -0300 Subject: [PATCH] Destroy cinemachine in Cloned Freecam mode as we won't be enabling it back again since the cam will get destroyed anyway, given that in some games the cinemachine cam would still bother us even if it's disabled. --- src/UI/Panels/FreeCamPanel.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/UI/Panels/FreeCamPanel.cs b/src/UI/Panels/FreeCamPanel.cs index 65349bc..2c5eee7 100644 --- a/src/UI/Panels/FreeCamPanel.cs +++ b/src/UI/Panels/FreeCamPanel.cs @@ -187,7 +187,7 @@ namespace UnityExplorer.UI.Panels ourCamera = GameObject.Instantiate(lastMainCamera); lastMainCamera.enabled = false; - MaybeToggleCinemachine(false); + MaybeDeleteCinemachine(); MaybeToggleOrthographic(false); // If the farClipPlaneValue is the default one try to use the one from the gameplay camera @@ -344,6 +344,20 @@ namespace UnityExplorer.UI.Panels } } + static void MaybeDeleteCinemachine(){ + if (ourCamera){ + IEnumerable comps = ourCamera.GetComponentsInChildren(); + foreach (Behaviour comp in comps) + { + string comp_type = comp.GetActualType().ToString(); + if (comp_type == "Cinemachine.CinemachineBrain" || comp_type == "Il2CppCinemachine.CinemachineBrain"){ + GameObject.Destroy(comp); + break; + } + } + } + } + static void MaybeToggleOrthographic(bool enable){ if (ourCamera) { if (enable) {