Support Forum

How to remove tag on node, (can't set to -1)

How to remove a tag from a node? node.Tag is a uInt and doesn’t allow -1.

Thanks!

Hi

The default tag is tag 0. So if you set the tag to 0 you effectively change it back to the default and remove your custom tag.

is there a visual way to see the current tags assigned? can’t find the way to.
Thanks a lot!

You can set A* Inspector → Settings → Graph Coloring = Tags.

1 Like

As I thought I already tried this but the only tags appearing on scene seem to be the ones created by the erosion.
None of the tags I’ve created manually seem to appear there, also, they don’t seem to have any effect… I’m creating them like this:

   AstarPath.active.AddWorkItem(new AstarWorkItem(ctx =>
		    {
			    Vector2Int tileUnit = Utils.V3WorldToV2UnitInt(tile);
				var node=    seaGraph.GetNearest(tile).node as GridNode;
			    node.Tag = tagId;
			    
		    }));

Is something wrong with it? or is the ‘Erosion Uses Tags’ messing my other tags?

Thanks again

Hi

That looks correct to me.
Erosion uses tags runs when the graph is scanned, so it wouldn’t be interfering with that.

Are you doing any graph updates (GraphUpdateScene component or AstarPath.active.UpdateGraphs)?

To see if your code is actually running, try something like AstarPath.active.data.gridGraph.GetNodes(node => node.Tag = 5); to set all tags in the entire graph.

Blockquote
Are you doing any graph updates (GraphUpdateScene component or AstarPath.active.UpdateGraphs)?

Yes I am, and I just realized every time I do it the tags get reseted. Why is this?

Thanks for your support

Tell me please. There is a line of code.

It’s a bit mask. So there are a lot of tags stored there. How can I do it so that one tag is deleted, and the rest of the tags remain?

@RikiTikiTak The tags field is not a bitmask. It’s just a single tag.

1 Like