Beginner question: Building a grid at runtime


Well met everyone.
I have been reading the documentation and the forum over the last day or two.
I am planning on implementing the astar project in my turn based grid game. The question I have is about adding nodes to the grid at the start of runtime.
What I thought I was going to do was, when the game generates the map (it is procedurally generated) I would add a node at each grid point that is walkable. Then I was thinking I could just have the A* Game Object load them all in. That is where I am at.
Reading over the documentation I was able to answer all sorts of questions I would have had later, like when a door opens, when the grid changes, etc. Very useful information available on all of that. I just seem to be not seeing adding nodes. I saw the information on accessing grid data directly and I may use that, but thought there was an easier answer I was missing.

Thank you


Found a post from 2014 that may answer my question:;
just thought I would leave this here in case someone else has the problem


Here is how I fixed it. I set AStarPath to use a point grid.
I then set that grid to use all children of a child object named “NodesCollection”

Here is the generation code:

        //I create a gameobject to parent the nodes to
        newNodesCollection = new GameObject(); = "NodesCollection";
        newNodesCollection.transform.parent = newMap.transform;

       //Here I call 2 Functions to generate the map

      //Next I move the parent gameobject with the nodes to be a child of the point graph root gameobject
        newNodesCollection.transform.parent = 


Is there a way to turn off diagonal connections? It isn’t a huge issue, but it would be preferable.

NM I just changed max distance to 1.4 instead of 1.5. Worked like a charm.


If you are still interested in knowing how to turn off diagonal connections, there is an explicit option for the number of connections on the grid graph, if that is what you are still using. It is here:


Thank you, but that is for a grid graph and I am using a point graph as it was easier to set up for procedural generation of maps of any size.