As usual, my code for this is fully shared on Github but is yet to be properly documented! That is the next task.
Anyway, for a sneaky preview of the finished article.
Features:
- It only starts pathfinding if the player is inside the grid, will also stop pathfinding once the player exits.
- Unwalkable grid positions are calculated at runtime start based on the tilemap colliders (via a layermask)
- pathfinding runs every x seconds as to not be continually calculating paths
Thank you!
Wouldn't have been possible without the excellent grid tutorials from CodeMonkey and of course Mr Taft! and his amazing Zelda-like.