0

I'm working on a C#/Unity project, and I want to know when the cinemachine virtual camera has fully transitioned to another cinemachine camera. I've seen people using IsBlending, but I'm still not sure how to implement that code in my project.

My code is like..

  private CinemachineBlend activeBlend = null;
  public bool IsBlending { get { return activeBlend != null; } }
  [SerializeField] private CinemachineVirtualCamera[] virtualCameras;

  void TestItIsWorking()
  {
    virtualCameras[0].Priority = 10;
    virtualCameras[1].Priority = 0; // -> this starts the blending the virtual camera
    Debug.Log("this function is called"); // -> prints "this function is called"
    Debug.Log(IsBlending); // -> prints false
  }

So I guess I'm doing something wrong because event the virtual camera has started to change, I get a false value as of IsBlending boolean. I also wrote while loop instead of just Debug logging the IsBlending value, but the result was still the same. I want to run another function right after the blending has finished, so if there is a better solution for this, please also let me know....

Yuuu
  • 715
  • 1
  • 9
  • 32

1 Answers1

0

Are you sure your activeBlend field getting a reference correctly? Using the IsBlending property of your CinemachineBrain is an option by the way.

Dozturk
  • 21
  • 1
  • 7