Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Freeze Frame

Discussion in 'Cinemachine' started by darthbator, Jul 9, 2018.

  1. darthbator


    Jan 21, 2012
    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):
    1. //FIXME this unsets the active virtual camera
    3. public IEnumerator FreezeFrame (int frames) {
    4.         //yield return null;
    5.         while (frames > 0) {
    6.             Camera.main.clearFlags = CameraClearFlags.Nothing;
    7.             yield return null;
    8.             Camera.main.cullingMask = 0;
    9.             frames--;
    10.         }
    12.         Camera.main.clearFlags = CameraClearFlags.SolidColor;
    13.         Camera.main.cullingMask = ~0;
    14.     }
    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?
  2. Gregoryl


    Unity Technologies

    Dec 22, 2016
    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.