Skip to content

Commit b82cc62

Browse files
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.
1 parent 9429b84 commit b82cc62

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/UI/Panels/FreeCamPanel.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void SetupFreeCamera()
187187

188188
ourCamera = GameObject.Instantiate(lastMainCamera);
189189
lastMainCamera.enabled = false;
190-
MaybeToggleCinemachine(false);
190+
MaybeDeleteCinemachine();
191191
MaybeToggleOrthographic(false);
192192

193193
// If the farClipPlaneValue is the default one try to use the one from the gameplay camera
@@ -344,6 +344,20 @@ static void MaybeToggleCinemachine(bool enable){
344344
}
345345
}
346346

347+
static void MaybeDeleteCinemachine(){
348+
if (ourCamera){
349+
IEnumerable<Behaviour> comps = ourCamera.GetComponentsInChildren<Behaviour>();
350+
foreach (Behaviour comp in comps)
351+
{
352+
string comp_type = comp.GetActualType().ToString();
353+
if (comp_type == "Cinemachine.CinemachineBrain" || comp_type == "Il2CppCinemachine.CinemachineBrain"){
354+
GameObject.Destroy(comp);
355+
break;
356+
}
357+
}
358+
}
359+
}
360+
347361
static void MaybeToggleOrthographic(bool enable){
348362
if (ourCamera) {
349363
if (enable) {

0 commit comments

Comments
 (0)