Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NullReferenceException when CinemachineFreelook Camera is disabled

Discussion in 'Cinemachine' started by Kev00, Nov 13, 2018.

  1. Kev00

    Kev00

    Joined:
    Dec 6, 2016
    Posts:
    229
    I get this error when a game object with an active CinemachineFreelook is disabled.

    NullReferenceException: Object reference not set to an instance of an object
    Cinemachine.CinemachineBrain.ProcessActiveCamera (System.Single deltaTime) (at C:/Users/x/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.cinemachine@2.2.7/Runtime/Behaviours/CinemachineBrain.cs:487)
    Cinemachine.CinemachineBrain.LateUpdate () (at C:/Users/x/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.cinemachine@2.2.7/Runtime/Behaviours/CinemachineBrain.cs:258)

    In this case the vcams are nested inside prefabs that are instantiated at runtime.

    Is there an update that fixes this?

    Thanks
     
    Last edited: Nov 13, 2018
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Yeah, this has been fixed in CM 2.2.8, available in preview. To be released soon.
     
  3. Kev00

    Kev00

    Joined:
    Dec 6, 2016
    Posts:
    229
    ok thanks. I managed avoid this error by creating a second camera brain that was in the layer I was working with.