- Home /
Question by
AppleseedSmoothie · Oct 30, 2016 at 07:52 AM ·
movementtransformnavmeshnavmeshagent
How to stop a Set Destination after it has already arrived?
So I have an empty game object which is placed down where the user clicks and some units then go to that destination using nav mesh. When they arrive the script deletes the game object but a error comes up saying that "your trying to use a transform that's been deleted". So I have the 'unit = gameObject.FindGameObjectWithTag("Unit").transform;' and the 'nav.SetDestination(unit.position);' set up yet when ever I attempt to stop the set destination with a boolean it still comes up with the issue. Also the nav mesh starts to bug and the individual units go running off in random directions sometimes. What should I do should I do some nav.enabled = false; stuff or is there some code where the set destination comes to an end?
Comment