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.
This commit is contained in:
@ -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<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){
|
||||
if (ourCamera) {
|
||||
if (enable) {
|
||||
|
Reference in New Issue
Block a user