Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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.