A* + Unity Tilemap: alignment & interactions

I’ve read a few posts on here about using a tile map with the A* package but I’m not entirely sure they’re talking about the 2D Tilemap package from the Unity Registry so I’m here to get some clarity.

The way I’m understanding it, if I want to do a hexagonal grid map I need to use this package (A* Pathfinding) for movement and Unity’s 2D Tilemap for laying out the ground and terrain sprites, but is there any way to easily sync these two things up?

First, I’m having quite the time getting them to line up with each other by just tweaking numbers in both the Pathfinding object and then in the Grid object. Is there an easier way to get these in sync and keep them that way?

Second, is there any way to maintain some interaction between A* and the Unity Tilemap? Like, when a character moves onto a tile in A* to have that tile swap to a different sprite in Unity Tilemap? Or would I need to always be grabbing the node in A* and then figuring out the overlapping node in Unity Tilemap?

Third, am I going about this the wrong way? Any input would be appreciated.

Hi

Currently, there is no interaction between unity tilemaps and the A* Pathfinding project, I’m afraid.

One thing that can be tricky with Unity hexagonal tilemaps is that they are, in fact, not hexagonal. They are slightly shrunk along one dimension.

This post might be of help to you: Help Matching the Hexagon Grid Graph to the 2018.2 2D Hexagon Grid (sorry that I still haven’t implemented functionality to match the settings automatically).

2 Likes

Hey @lemmons , I have some posts on here that may help but I haven’t used astar with hex tilemaps. I can’t imagine it’s very different though. I have had good success with 2D isometric tilemaps.

1 Like