Updating two graphs with UpdateGraphs


I have two grid graphs one on top of another: one for ground objects and one for air objects. Both graphs use collision testing with the correct obstacle mask. UpdateGraphs works fine when I enable the mesh collider of the object at runtime, but when I disable the mesh collider and call UpdateGraph again, only the graph on the bottom gets updated, while the graph on top remains the same. Any ideas why this might be? Thanks!

    public void UpdateGraph()
        var guo = new GraphUpdateObject(GetComponent<MeshCollider>().bounds);// Set some settings

Screenshots of the example:


A follow-up question is that the graph on top is not accurately updated to fit the mesh collider’s bounds. This is the accurate graph:

But as you can see from the image on top, the graph cuts out a huge rectangle instead.


When you have disabled the mesh collider, are you sure the bounding box is still correct?

Hi Aron, Nevermind the issue has been solved. I realized I disabled the collider of the “aerial floor” when the game starts, so there wasn’t any “floor” for the astar object to scan when updating. Hence the hole not being filled after disabling the dynamic object. Thanks a lot!

1 Like