Freeze Frame

So I'm trying to implement a "frame stick" or "Freeze frame" type functionality in my game. I've previously done this in the following manner,

Code (CSharp):

//FIXME this unsets the active virtual camera

public IEnumerator FreezeFrame (int frames){

//yield return null;

while(frames >0){

Camera.main.clearFlags= CameraClearFlags.Nothing;

yieldreturnnull;

Camera.main.cullingMask=0;

frames--;

}

Camera.main.clearFlags= CameraClearFlags.SolidColor;

Camera.main.cullingMask= ~0;

}

However cinamachine appears to not want me to access the camera in this way... this unsets my active virtual camera and leaves me in a broken state. I've tried to address the camera through the cinemachine brain but I get the same result. How am I meant to achieve a feature like this with cinemachine?

Unity Technologies

I think the problem is in the culling mask. Cinemachine will only see the vcams that are on layers contained in the camera's culling mask. So when you set it to 0, CM can no longer see the vcams and loses its state. Try putting the vcams on their own layer, and instead of setting the camera's culling mask to 0, set it to that layer. Then CM will still see the vcams.