Confusion over path.enabledTags

I am having some issues with getting certain nodes to be not navigable for certain characters. Looking at the documentation for Tags it seems like path.enabledTags coupled with setting a node’s Tag property should get me the behavior that I want. My confusion comes from the fact that it seems to be behaving opposite of what I would expect. The default value for the enabledTags is -1 (all bits set. To restrict movement on a node with a tag of 2, I would expect the path.enabledTags to have a value of ~2 (all bits BUT the node’s tag), but it seems that setting to a value of 2 is actually working. Is this how the enabledTags of the path object is supposed to work? If so it seems like it is acting more like restricted Tags rather than enabled Tags, which is confusing with the default being all ON. Our code does not use the Seeker behavior so everything is being set in script.

node.Tag = 2

path.enabledTags = -1 (navigable)
path.enabledTags = 2 (not navigable)
path.enabledTags = ~2 (navigable)

TLDR: Why does the path’s enabledTags mask not match the node’s tag?


Sorry for the late answer.

A mask set to 2 will have the bit pattern


Notice that bit 1 is set.
You will want to set bit 2, the way to do that is using bit shift operators like this

// Make sure the agent can traverse nodes with tag 2 or 5.
enabledTags = (1 << 2) | (1 << 5);

// Make the agent be able to traverse all tags except tag 2
enabledTags = ~(1 << 2);