Blend won't stop and it's causing lots of problems

Hi,

So I’ve got two virtual cameras that I want to blend between. I want to zoom in with my second camera after blending and then I want to zoom out again after a certain condition is met. Actually, I’ve already somewhat described my problem here.

I have already achieved a blend between the two cameras with the following code:

firstVCam.enabled  = false;
secondVCam.enabled = true;

And I am attempting to zoom in with the second camera after the blend starts with this code:

secondVCam.m_Lens.FieldOfView = 20; // zooming out is obviously just setting this value higher again

But there are some problems. First off, the zooming in with the secondVCam does not have any visual effect unless I pause my game, which happens with this code:

void PauseGame() {
  isRunning = false;
  Canvas ().pausePanel.SetActive (true);
  Time.timeScale = 0;
  Cursor.visible = true;
  Cursor.lockState = CursorLockMode.Confined;
}

However, the zooming in does have an immediate visual effect if I instead set the FOV on the firstVCam. But I cannot do this because the actual camera’s physics start to get wonky if I do this stuff on the firstVCam. I believe that the root cause of this problem is that the firstVCam remains in a “Live” status even after it’s not enabled. The reason for this seems to be that the vcams do not stop blending. I determined this by putting the following code in my Update() method:

Debug.LogError("IsBlending: " + Camera.main.GetComponent<CinemachineBrain>().IsBlending);

Which continuously outputs IsBlending: True in the console. It seems that the cameras do not stop blending, which explains why the firstVCam refuses to stop being “Live”. According to CinemachineBrain.IsLive()'s summary:

So I think I need to somehow forcibly tell my vcams to stop blending at a certain point. How do I do that? Also, am I correct in my assumptions as to the underlying causes of these issues? I would certainly appreciate any feedback to help me get a better understanding. Perhaps @Adam_Myhill can provide some insight?

Quick question up front:

Why not just enable camera 2 and have camera 2 have a more telephoto lens? This way you get the blend and the zoom at the same time? It also means you can adjust more than the zoom for camera 2 if desired (composition, position - whatever)

It seems like all the other issues are due to they way you’re trying to do zooming, which is so much easier if you just blend to a camera with a different lens. Would that not work?

Yes. What Adam said.
Also: the blend is never going away because you’ve paused the game. By default, the cameras pause too, along with any blends. If you don’t want them to, then you can check the “Ignore Timescale” checkbox on the Brain.

Thank you both for your advice. Your advice, @Adam_Myhill , has helped to simplify my code a lot and it seems to work. Your advice, @Gregoryl , about the “Ignore Time Scale” checkbox is exactly what I needed with all the issues I described. Thanks again, I really appreciate it.