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. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Null ref exception in the Brain

Discussion in 'Cinemachine' started by Redux, Dec 7, 2018.

  1. Redux


    Nov 10, 2011
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Cinemachine.CinemachineBrain.ProcessActiveCamera (Single deltaTime) (at C:/Users/Shatt/AppData/Local/Unity/cache/packages/
    3. Cinemachine.CinemachineBrain.LateUpdate () (at C:/Users/Shatt/AppData/Local/Unity/cache/packages/
    Cinemachine 2.2.7 here.

    The only thing I'm really doing is setting priorities via script and calling MoveToTopOfPrioritySubqueue() on the camera I've affected.

    Any help appreciated, I'd like to clear this up.

    I also disable camera's via script (enabled = false) on the virtual camera. Not sure if that would be relevant.
  2. Gregoryl


    Unity Technologies

    Dec 22, 2016
    What's happening is that there is no current active vcam, and the Brain is complaining. In fact it's a bug, and the latest CM 2.2.8 (available in preview) gracefully handles the case when there is no current active vcam.

    You can work around this by ensuing that there is always an active vcam. Maybe have a dummy "do nothing" one on the brain itself, just to catch those frames when nothing else is active.