2D and A* walkable on chosen layers

Hi, I recently purchased A*, however I find a small problem.

I was wondering, is there a way to create a 2D graph, that will be walk able only on certain layers of 2d colliders?

Hi

Right now this is not possible out of the box. You can, however, use a small custom script to assign the walkability of the nodes afterwards based on e.g. colliders. Take a look at this page: https://arongranberg.com/astar/docs/graph-updates.php#direct

Hi,

thank you for your fast response. I took liberty in diving little bit deeper in to code I came with this solution to check layers when doing casts.

Base.cs

GridGeneratorEditor.cs

Of course this is proof of concept implementation, but it seems to work, what do you think about it? Can it backfire in anyway later?

1 Like

That will probably work fine.