CinemachineBrain exception when loading new scene

Hi guys, the following exception popped up when updating to Cinemachine v2.6.3:

What happens is that our custom scene manager hooks SceneManager.sceneLoaded to disable existing level when a minigame (new scene) finished loading. CMB is not present in the minigame scene. In our scene manager handler, the existing CMB is disabled, triggering CinemachineBrain.OnDisable()

Because OnDisable is triggered directly from SceneManager.sceneLoaded, even though CMB.OnSceneLoaded is removed from SceneManager.sceneLoaded delegate, it is still invoked.
Thus, SceneManager.sceneLoaded → CMB.OnSceneLoaded → CMB.ManualUpdate → CMB.UpdateFrame0

Now UpdateFrame0 does not handle updating the frame very well when there is no active CMB in the scene.

Any idea what to do now? Seems like a simple check for empty List in CMB would suffice to fix this…

1 Like

Thanks for reporting this edge case! We’ll add a nullcheck for the next release.

1 Like