NullReferenceException on play

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

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.

1 Like
19289: [Unity] NullReferenceException: Object reference not set to an instance of an object
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
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
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

Are these lines of code making my cloud build fail?

Which version CM?

The one from the Asset Store I think…is there a better way to tell?

These messages are a known issue, fixed in the latest beta, available here: CM v2.1 beta release: New features, new fixes, improvements, examples, - Unity Engine - Unity Discussions
You can see the version in Cinemachine/About

Updated and now it builds correctly, thanks!