You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
UnityEngine.Transform.get_position () (at <779cc116a5954f1c9b92496e62345641>:0)
EntityController+<DespawnCoroutine>d__11.MoveNext () (at Assets/Scripts/EntityController.cs:70)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <779cc116a5954f1c9b92496e62345641>:0)
The text was updated successfully, but these errors were encountered:
transform.position = Vector3.Lerp(startPosition, targetTransform.position, t);
Maybe problem not in transform.position but in a targetTransform.position.
Imagine, when coroutine starts targetTransform is already dying, and when it was dead, there will be NRE, because food that was being consumed is still alive. Possible solution is just remember position of targetTransform before starting to wait. Or pooling objects (then there never be nre).
sometimes you get
The text was updated successfully, but these errors were encountered: