AstarPath.active.Scan() not detecting colliders

I’m using a 2d graph, which is being resized at Start() to match the size of a dynamically generated map. However, the Scan() function does not seem to be detecting the colliders that have been placed on the map. If I press the Scan button on the A* GameObject while the scene is running, it works great and picks up the colliders.

Here is the code I’m using:

    var gg = AstarPath.active.data.gridGraph;
    var width = bounds.left + bounds.right;
    var depth = bounds.top + bounds.bottom;
    var nodeSize = 1.0f;

    gg.SetDimensions(width, depth, nodeSize);

    // Recalculate the graph
    AstarPath.active.Scan();

Hi

Are you sure you scan the graph after your map has been generated?

Yes. 100%

 public void GenerateDungeon()
        {
            log("Dungeon seed: " + seed);
            this.random = new System.Random(seed);

            generate();

            dungeonView.Draw(dungeon, constraints);

            // Update pathfinding grid
            var gg = AstarPath.active.data.gridGraph;
    var width = bounds.left + bounds.right;
    var depth = bounds.top + bounds.bottom;
            var nodeSize = 1.0f;

            gg.SetDimensions(width, depth, nodeSize);

            // Recalculate the graph
            AstarPath.active.Scan();
        }

I suppose it might be possible that the physics engine has not updated things yet. Try calling Physics.SyncTransforms before scanning the graph.

See https://docs.unity3d.com/ScriptReference/Physics.SyncTransforms.html

Unity 5 doesn’t have that function, however I put the Scan inside a coroutine that runs 0.1 seconds after and it seems to be working.

Sorry to necro. Just wanted to say that this indeed was what fixed the problem for me. Might be worth adding it into the source? Maybe an overload on scan to force it?