I’m getting the exception:
Trying to initialize a node when it is not safe to initialize any nodes. Must be done during a graph update
When I try to run GenerateNodes on a newly created NavMeshGraph. Here is my code:
Pathfinding.NavGraph graph = AstarPath.active.astarData.CreateGraph(typeof(Pathfinding.NavMeshGraph));
Pathfinding.NavMeshGraph navGraph = (Pathfinding.NavMeshGraph)graph;
navGraph.GenerateNodes(navVerts.ToArray(), navTris.ToArray(), out origNavVerts, out origNavTris);
AstarPath.active.astarData.AddGraph(navGraph);
Not sure how I can cause this to run “during a graph update”, so any help would be appreciated.
-Sean