- Home /
              This question was 
             closed Aug 24, 2020 at 07:15 AM by 
             tedrasoft for the following reason: 
             
 
            Problem is not reproducible or outdated
 
               Question by 
               tedrasoft · Jul 19, 2020 at 05:15 PM · 
                scene-switchinggetmissingreferenceexceptionset  
              
 
              Getter/Setter throwing missing reference on scene change
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
               Comment
              
 
               
               koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                