Trying to get A* working on a procedural generated map

I’m trying to intergrate this awesome A* into my procedurally generated map. But somehow the entire map is filled with yellow boxes (I’ve changed the color for unwalkable node to yellow.).

So this is what I did.

  1. Created AStar Path, filled in all the data, set the center’s y coordinate to -0.1 (basically everything mentioned at the 'Getting Started with A* Pathfinding Project).

  2. I’ll run my project and it will procedurally generate my map.

  3. After I’m done generating, I call the Scan function by using the following code:
    AstarPath.active.Scan();

And this is what I’ve got.
Is this normal since I do not have a character (target) in the map, so the algorithm is not able to figure out whether or not this is a reachable node / area since there is no starting position?
Any help will be appreciated!

Edit: Its sad that a new user cant upload an image. I’ll posted the url with the (dot)png instead of .png

http://rs1292.pbsrc.com/albums/b580/dwnenr/AStart_zpshqt98zux.png~320x480

Edit 2: By the way, does anyone know why I’m getting different color lines on walls? They arent colors that are in the AStar Path script.

Hi

Your screenshot is unfortunately not working, do you think you could upload it again?

@aron_granberg
Oops sorry about that. I’ve reuploaded the image. The new link is on the 1st post. Sorry about that.

I’ve found out what was causing the issue.
Apparently the plane had to be scaled to fit your entire map.
I only instantiated a default plane and was creating a map which is 80 x 55 (Unity units).

1 Like

Ok, great that it is working now.

The different colors represent different graph components, i.e regions so that there is no path from one region to another region with another color. Likely you want to put your walls inside a separate layer and mark that layer as an obstacle in the grid graph collision settings.