MissingReferenceException: The object of type ‘Transform’ has been destroyed but you are still trying to access it.Your script should either check if it is null or you should not destroy the object.
So basically my gameObject gets destroyed and this part of the code is still accessing it. I would like to be checking for null I have tried the following below with no luck.
if( !_playerController )
if( _playerController == null)
if( _playerController != null)
Does someone have a better way around this? or to stop it from accessing my gameObject?
As a MonoBehaviour gets destroyed, OnDisable and OnDestroy are called. You need to make sure that at least after OnDestroy was called, you are not anymore calling updateCameraPosition.