Hi Guys,
In my game I have several getters that get the position of some transforms. They look like this :
> [SerializeField] private Transform> _workerDropOffTransform;> [SerializeField] private Transform _workerLoadTransform;>> public Vector2 WorkerLoadPosition =>> _workerLoadTransform.position;> public Vector2 WorkerDropOffPosition =>> _workerDropOffTransform.position;
However, when I change my scene they sometimes return the following error :
MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it. I'm guessing it's trying to fetch the transform in the last frame when the previous scene is closed.
How can I fix this?
Thanks in advance, guys
↧