Can I Get All Node Tags Between an Object and its Target?

I’m planning to get my enemy AI objects to take alternate paths to the player.
My plan is to separate my levels into different tagged areas, and in situations where enemies calculate paths through the same areas to get to the player, enemies further away would find the area tags between them and the player and apply a personal penalty to those tags, increasing the likelihood that they choose an alternate path that results in effectively flanking the player.
It looks like I can use GetTagNames to grab all of the tags associated with the AstarPath object.
Is there a way to get all tags on nodes along a specific path?

Is there a better way to achieve what I described? I’m aware of the alternative path modifier, but it doesn’t get the exact behavior I’m after.

Thank you for your time!


Yes, you can do that. If you have a path object called ‘mypath’ then you can do

var nodes = mypath.path;
for (int i = 0; i < nodes.Count; i++) {
    Debug.Log("Node " + i + " has tag " + nodes[i].Tag);

Thank you for such a prompt reply.
This was extremely helpful!