UpdateGraphs ignoring some objects?


I’m trying to do something that seems to be allowed based on documentation: updating a part of a graph (two graphs, actually) which is inside of some bounds. I am adding a bunch of objects at runtime, and they should start affecting the pathfinding.

The code is pretty much taken from the documentation:

GraphUpdateObject graphUpdateObject = new GraphUpdateObject(levelBoundsInstance.GetComponent<Collider>().bounds);
graphUpdateObject.updatePhysics = true;

This is what it looks like after I do it:

And this is what it should look like (I get this if I press Scan or Scan from code):

Why are some of the objects missed completely if I UpdateGraphs? And why are the other objects missed partially? I think I’m doing something wrong, but I can’t figure out what.

I’m using the latest version of the plugin and the latest version of Unity.

Edit: I should probably also mention that I’ve tried updating graphs for each individual object’s collider bounds with the same result. I have also tried using GraphUpdateScene and calling the Apply method on that, also with the same result. I am totally out of ideas at this point.

Edit 2: If I change the size property of the colliders, it seems to affect the result of UpdateGraph. Increasing the size of the house colliders manually makes them appear on the graph at least. However, I still can’t get it to match the result I get from scanning the whole graph.


Sorry for the late answer.

Depending on which version you are using you may have to call Physics.SyncTransforms() before updating the graph. This is due to a recent change in the Unity physics engine.

Are you sure the bounding box is correct for the obstacle? You could use Debug.DrawLine(bounds.min, bounds.max, Color.red, 5); to debug it.