Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    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.