Hey there,
(I did search on the forum and couldn’t find a dupe, apologies if this was answered before)
I have a 200x200 GridGraph with nodes 5 units in size. The graph has all collision testing turned off, so it’s essentially a flat fully-connected grid where I can set penalties on individual nodes.
I set penalties like so:
public void updateGoAnywhereGraph(int penalty, WorldPosition wp) {
MyGUO guo = new MyGUO();
guo.setPenalty = penalty; // set to 200 * 1000 elsewhere
guo.bounds = new Bounds(wp.position, new Vector3(10,5,10));
Debug.Log("bounds is: "+guo.bounds);
guo.nnConstraint.graphMask = GraphMask.FromGraphName("construction_worker");
AstarPath.active.UpdateGraphs(guo);
}
public class MyGUO : GraphUpdateObject {
public int setPenalty = 0;
public override void Apply (GraphNode node)
{
base.Apply(node);
node.Penalty = (uint) setPenalty;
}
}
The first time I run the update, it behaves as expected - the nodes which fall within the bounds get updated, so according to the gizmos I have a 2x2 patch of nodes coloured red, everything else green.
However, I then run the update on an immediately adjacent square of the graph. The update correctly sets the penalties of the new nodes, but one row of the immediately adjacent, and previously updated, nodes have their penalties reset! (at least, they turn green in the gizmos)
I can repro this along both X and Z axes. Any idea what’s going on?