Imagine in the middle of moving unit recieved order to stop. How to this correctly?
Depends on what script you use for movement.
Assuming you use AIPath you will need to inherit from it in another class, and then when you want to stop. Do something like
//To cancel eventual calculating paths seeker.GetCurrentPath().Error(); //Remove path so the unit has nothing to follow path = null;
@aron_granberg What if using RichAI ? Will the same code work ? Because for me it didn’t.
What’s probably happening is that the unit “stops” momentarily, but then a new call is made to repath.
There is a setting to disable repathing and to not follow the waypoints, as well as invalidating the calculated path described above.
You will want to ensure that your unit stops repathing, stops following waypoints, and the path is nullified so it can be recycled by the garbage collector.