Making an enemy that only moves in cardinal directions

Hi

It’s not possible to find a path with the minimal number of turns in this package. This would require a different pathfinding algorithm. It’s not easy to just bolt on, I’m afraid.

However, you can get pretty good results using the manhattan heuristic.
You mention that you want to do this for only some enemies. Fortunately, you can set this value per-path.

// Disable the agent's built-in path searching routine
ai.canSearch = false;

var path = ABPath.Construct(...);
path.heuristic = Heuristic.Manhattan;
ai.SetPath(path);