Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

Getter/Setter throwing missing reference on scene change

$
0
0
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

Viewing all articles
Browse latest Browse all 215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>