A* Pathfinding Project

Visualise current tags?


Hi there!

I’m wondering if there’s anyway to see the currently applied tags. I’m trying to debug my use of tags, but there doesn’t seem to be a nice way to visualise them?



on the AstarPath object check Settings Debug Graph Coloring. Change it to tags. :slight_smile:


Oh, thanks! Unfortunately it seems like my code doesn’t seem to be working then (or the tag visualisation? Hehe.) Here’s what I’m doing:

using UnityEngine;
using Pathfinding;

namespace Gameplay.AI {
    public enum AstarGraphTag { Default, LockedDoor, Window }

    public static class AstarGraphManager {
        public static void UpdateTags(Bounds bounds, AstarGraphTag tag) {
            GraphUpdateObject guo = new GraphUpdateObject(bounds) {
                updatePhysics = false,
                modifyTag = true,
                setTag = (int)tag


        public static void UpdatePhysics(Vector2 position, Vector2 size) {
            UpdatePhysics(new Bounds(position, size));

        public static void UpdatePhysics(Bounds bounds) {

But the entire grid is grey after using this to set LockedDoor or Window. (I assume the default tag is 0?)


Alright, I figured it out. Turns out my bounds were too small. How are tags applied? I basically want to tag anything in my collider’s area. But it seems that if the area doesn’t encompass a node entirely then it’s not applied?


That’s not how it works for me. If I have a collider even barely crossing the boundaries it changes the tag value… here’s a script I threw together based off yours that when attached to an GO with a collider works pretty well… at least for navmesh graphs…

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Gameplay.AI;

public class AstarGraphUpdateObj : MonoBehaviour {

 public Bounds bounds;
 public int tagInt;
 Collider col;
 void Start () {
  col = gameObject.GetComponent<Collider>();
     bounds = col.bounds;
 public void ActivateByInt(int Int)
     bounds = col.bounds;
     AstarGraphTag AsGT = (AstarGraphTag)Int;
     AstarGraphManager.UpdateTags(bounds, AsGT);
 public void ActivateByInt()
     bounds = col.bounds;
     AstarGraphTag AsGT = (AstarGraphTag)tagInt;
     AstarGraphManager.UpdateTags(bounds, AsGT);
 public void ActivateDefault()
     AstarGraphManager.UpdateTags(bounds, AstarGraphTag.Default);
 public void ActivateDeWindow()
     AstarGraphManager.UpdateTags(bounds, AstarGraphTag.Window);



Hi Christougher,

Thanks for testing that out! That’s not the behaviour I’m seeing, but I’m using a grid graph? I wonder if that could be the difference?



For navmes/recast graphs I believe all nodes that are are inside or touch the bounding box will be updated. For grid graphs their centers have to be inside the bounding box both for performance reasons (the cells are usually tight enough that it doesn’t matter much) and that people often do updates with 1x1x1 boxes which are precisely as large as one node, and then it’s not very nice if they sometimes manage to update nearby nodes as well due to floating point errors.