Tagging procedural 2D tiles

Hi

I think the best method would be to subclass the GridGraph and override the RecalculateCell method.
The benefit of doing this is that everything will work out of the box with graph updates and the ProceduralGridMover script.

public class MyGridGraph : GridGraph {
    public override void RecalculateCell (int x, int z, bool resetPenalties = true, bool resetTags = true) {
          var node = nodes[z*width + x];
          // Set the node's initial position with a y-offset of zero
          node.position = GraphPointToWorld(x, z, 0);
          node.Walkable = DoSomeWorkHere();
          node.Tag = 0;
          // Store walkability before erosion is applied
          // Used for graph updates
          node.WalkableErosion = node.Walkable;
    }
}

You would also have to add

[CustomGraphEditor(typeof(MyGridGraph), "My Custom Grid Graph")]

To the GridGraphEditor.cs script, otherwise it will not show up in the graph list.

Make sure the ‘Gizmos’ button is enabled. It is in the upper-right corner of the game view.