Grid Pathfinding for Unity
A small pathfinding library for Unity 6, written from scratch: a grid graph, A* search, path simplification, an agent that walks the paths, and graph updates while the game runs.
What is in it
- Grid graph
- Walkability from colliders, optional ground raycast for heights, slope and step limits, 4- or 8-way moves that never cut a corner.
- Search
- A* with an octile heuristic, per-cell penalties, 32 tags an agent can forbid or make expensive, partial paths when the goal cannot be reached.
- Regions
- Connected areas are labelled, so an unreachable goal does not flood the map — the search aims for the nearest reachable cell.
- Simplification
- Paths are reduced to the corners that matter, by line of sight on the grid.
- Threads
- Searches run on worker threads and come back on the main thread, or on the main thread within a per-frame time budget.
- Runtime updates
- Rescan a region when a collider changes; agents ask for a new path.
- Agent
- Follows the path, turns, stops, re-plans at an interval; moves a transform or a CharacterController.
What is not in it
- Navmesh or recast graphs — use Unity’s AI Navigation package for those.
- Rotated, layered or hexagonal grids, and off-grid links.
- Saving a scanned graph: it is rebuilt when the scene starts.
Requirements
Unity 6.3 LTS or newer. Burst is optional; the search kernel uses it when it is installed.
Availability
The package is not released yet. Write to [email protected] if you want to hear when it is.