Updating a tiled recast graph

Hi,

I’m updating my tiled recast graph with code that looks a bit like this

Vector3 size = new Vector3(400, 60, 400) * 2; 
GraphUpdateObject guo = new GraphUpdateObject(new Bounds(transform.position, size));
guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);

but even though the size goes over the edges to other tiles there are times when the next tile wont update causing something like this:

Hi

Are you totally sure the bounds extends over to the other tiles?
You might be able to visualize it using Gizmos.DrawCube or Debug.DrawLine. Even if the bounds exactly encloses the objects, you might need to expand it slightly since the area that is removed by them is usually a bit larger than the actual objects (due to the character radius setting).

Also know that the updating is not instantaneous, it will take place during the next few frames, so make sure the colliders/meshes stay where they are.

Hey,

That seemed to be the problem, but I ended up having to add 3x character radius to the bounds or it was just outside.

Now I have the problem that it seems to disconnect tiles and I can’t get it to reproduce it that often. Do you have any ideas?

If you get that error, it would be really awesome if you could try to save the project so that I can replicate it.
I have heard other users get that bug, but it’s really hard to debug it without a reproducible test case.

The last 10 games I’ve played I haven’t been able to get it :confused: I will try and see if I can figure out the jist of it and make a scene where it is reproducible

1 Like