1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2025-07-18 17:38:01 +08:00

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.
Some checks failed
Build CinematicUnityExplorer / build_dotnet (push) Has been cancelled
Build CinematicUnityExplorer / build_connector (push) Has been cancelled

This commit is contained in:
originalnicodr
2025-02-26 00:45:15 -03:00
parent 9429b84cfa
commit b82cc62186

View File

@ -187,7 +187,7 @@ namespace UnityExplorer.UI.Panels
ourCamera = GameObject.Instantiate(lastMainCamera); ourCamera = GameObject.Instantiate(lastMainCamera);
lastMainCamera.enabled = false; lastMainCamera.enabled = false;
MaybeToggleCinemachine(false); MaybeDeleteCinemachine();
MaybeToggleOrthographic(false); MaybeToggleOrthographic(false);
// If the farClipPlaneValue is the default one try to use the one from the gameplay camera // 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<Behaviour> comps = ourCamera.GetComponentsInChildren<Behaviour>();
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){ static void MaybeToggleOrthographic(bool enable){
if (ourCamera) { if (ourCamera) {
if (enable) { if (enable) {