Using Area instead of Tag

Hello i’m having a problem with the limited tags to 32
And I want to use Area instead of Tags to my nodes, because Area allows me to give any node unlimited numbers, Can i replace the whole tagging system to Area?

Hi

The tags field is limited to 32 values because it is in a bitpacked field to reduce memory usage. You can move it to its own field to get up to 2^31 tags though.

In the GraphNode.cs file, replace these lines

/** Node tag.
 * \see \ref tags
 */
public uint Tag {
	get {
		return (flags & FlagsTagMask) >> FlagsTagOffset;
	}
	set {
		flags = flags & ~FlagsTagMask | value << FlagsTagOffset;
	}
}

with

/** Node tag.
 * \see \ref tags
 */
public uint Tag { get; set; }

Note that if you are saving and loading graphs during runtime (see https://www.arongranberg.com/astar/docs/save-load-graphs.php) then tag info will no longer be saved. If you need to save the tag info you will have to modify the GraphNode.SerializeNode and GraphNode.DeserializeNode methods to add the Tag field.

Also note that while this will allow you to set very large tag values, the tag mask fields that are in e.g the NNConstraint class still assumes that there are only 32 tags. Which other parts you will have to change depends on what you are going to use it for.

See also Having more than 32 tags and large ennemies

Thank you that works now i can give 32+ tags to the nodes
but still the seeker have 32 tags available only

Can i remove the toggle system and replace him with an integer list, and this list should be in single gameobject in the scene which all the seekers will use this list, instead of making multiple lists in each seeker, is there a possibility to do this?.

Hi

It’s possible with some modifications yes. I haven’t done it myself at any point though, so I haven’t got any code snippets to share right this moment.