Search Unity

NullReferenceException on play

Discussion in 'Cinemachine' started by OhiraKyou, Aug 9, 2017.

  1. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    I'm using a FreeLook Camera with a Cinemachine Collider script on the same object. Both the FreeLook and the Collider work as expected, but I get two each of two separate errors every time I press play.

    There's this:
    NullReferenceException: Object reference not set to an instance of an object
    Cinemachine.CinemachineFreeLook.UpdateRigCache () (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineFreeLook.cs:361)
    Cinemachine.CinemachineFreeLook.RemovePostPipelineStageHook (Cinemachine.OnPostPipelineStageDelegate d) (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineFreeLook.cs:168)
    Cinemachine.CinemachineCollider.OnDestroy () (at Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineCollider.cs:178)​

    and this, below it:
    Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)​

    Versions
    Cinemachine version 2.0.1
    Unity version 2017.1.0f3
    Windows 10
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,712
    Thanks for the post. This is a known issue which has been fixed on the CM trunk. Watch out for the next point release, coming soon.
     
    OhiraKyou likes this.
  3. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    Code (CSharp):
    1. 19289: [Unity] NullReferenceException: Object reference not set to an instance of an object
    2. 19290: [Unity]   at Cinemachine.CinemachineFreeLook.UpdateRigCache () [0x000dd] in /BUILD_PATH/kid-s-revolt.turtle-s-quest.default-windows-desktop-64-bit/Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineFreeLook.cs:361
    3. 19291: [Unity]   at Cinemachine.CinemachineFreeLook.RemovePostPipelineStageHook (Cinemachine.OnPostPipelineStageDelegate d) [0x00009] in /BUILD_PATH/kid-s-revolt.turtle-s-quest.default-windows-desktop-64-bit/Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineFreeLook.cs:168
    4. 19292: [Unity]   at Cinemachine.CinemachineCollider.OnDestroy () [0x00024] in /BUILD_PATH/kid-s-revolt.turtle-s-quest.default-windows-desktop-64-bit/Assets/Cinemachine/Base/Runtime/Behaviours/CinemachineCollider.cs:178
    5.  
    Are these lines of code making my cloud build fail?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,712
    Which version CM?
     
  5. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    The one from the Asset Store I think...is there a better way to tell?
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,712
  7. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    Updated and now it builds correctly, thanks!