From what I understood after watching the first video, the problem starts when you place something on the enemies’ path. Given your code calculates a new path, the new path might be wrong. Since the scene is fairly complex (= many waypoints), debugging the path might be a bit exhausting. For now, figure out how many elements the path
list contains before and after the recalculation.
If the path
suddenly contains a very high number of elements, it might be that it has not been cleared. In that case, check your code again to figure out if the code does what you expect it to do. The behaviour of the enemies looks as if their path got recreated over and over again, maybe even based on the wrong coordinates. Debug.Logs can help you understand which and how often code-blocks get executed during runtime.
If the issue still remains, create a new scene with a much smaller grid and try to recreate the problem. If you were able to recreate it, you could log the coordinates of the single path
elements into your console and manually check if they form the expected path or if there is chaos. You don’t want to check hundreds of coordinates manually. That’s why I suggested the “much smaller grid”.
Debugging can be a bit repetitive and boring but if you check your code and data systematically, you’ll eventually find the problem.
I did not understand bug 2. What is the problem in the second video?
Since both videos seem to refer to the path and enemy movement, I assume that the problems might be related. Try to fix the obvious problem from the first video first.