A* Pathfinding Project

2D Top Down Grid based Issues


I purchased the pro version today, and after upgrading to pro, I am having quite a few issues and unexpected results that I need some help with.

The game I am making is a top down 2D puzzle game.

The first issue I am having is that if i place the enemy with an attached AILerp script, the Seeker Script and the AI Destination setting script, next to a wall, the enemy will teleport or glitch to a random place in the level. The path he is on is valid its just close to a wall.

The second issue I am having is if I move an object in the path of the enemy, sometimes the enemy will move right through it. I am trying to update the graph when the object is moved so that the enemy knows it can’t move there however it feels like maybe I am not calling it fast enough if the enemy is too close? I really don’t know why it works sometimes and not others.

The last issue i have, is that if more than one enemy run into each other, they will just pass through each other. This could be the same as the second issue where the graph needs to be updated to know that there is an impassible object in the way?

One other note. I have the path being calculated then i check to see if it is possible to get to the target, If there is not a valid path to the target I then I disable the AI Destination Setter script, use the random function to roam around until it gets within a certain distance, then re-enable to AI destination setter script. is this the best way of doing this? or should I be doing something else?

Thanks for any help!



  1. Can you post a video of the first issue?

  2. Agents recalculate their paths periodically. This is controlled by the repathRate on the agent. E.g. if you set it to zero then the agent will recalculate its path every frame if it can. You can also call ai.SearchPath to make it recalculate its path immediately. This is good if you have just moved an obstacle.

  3. There is no built-in agent-agent avoidance in the package for that kind of grid based movement. There is https://arongranberg.com/astar/docs/local-avoidance.php, but it sounds like that wouldn’t really suit your game. You can also look at https://arongranberg.com/astar/docs/turnbased.html, but that is hard to integrate in a real time game.

  4. I would recommend not using the AIDestinationSetter and instead set the ai.destination property directly. Then you can make it roam around or set it to a target without having to enable/disable components. https://arongranberg.com/astar/docs/aibase.html#destination


I uploaded a quick little video here, basically it happens if he it is by any wall or object, once he pops out to where ever he will path just fine. https://youtu.be/wDm9CojTq2M


Could you show me the grid graph in the scene view?
I have a feeling that those nodes are unwalkable. Maybe you have to reduce the Grid Graph -> Collision testing -> diameter to something like 0.99 to get rid of floating point errors (if your colliders are exactly the same size as the tiles).


Thanks for the quick responses on this. I think your project is just too much for what I need and will take too much customization and learning of it. It’s really unfortunate, since i can tell your project is great, just more than I need. I started on a simplified A* grid based script that seems to suit what I need better. I want to thank for your time and let you know you can close this thread.