Issues with point graph: local updates not possible and GC allocation spikes with URP

I have a point graph that is updated at runtime each time a new cube is placed in a strict 3D grid. The game starts with no points and they are added and the graph updated as the player places cubes. I am having two main issues:

  1. Local updates just won’t work. I tried everything, the bounding box is correct. It just won’t update. The code is the following in my GraphUpdater class:

public void UpdateLocal(Bounds bounds, int nGraph)
{
var guo = new GraphUpdateObject(bounds);
guo.nnConstraint.graphMask = 1 << nGraph;
AstarPath.active.UpdateGraphs(guo);
}

When the cube is created I pass some bounds around it and the graph number (in this case 1 since I have two graphs).

  1. I recently switched my project from built-in to URP and a suddenly I have massive lag spikes when I place a new cube and update the whole point graph (I have to update the whole graph since local updates won’t work, but in built-in it was never an issue). Here is the profiler:

    There seems to be a lot of GC allocation for reasons I can’t fathom. These spikes come even if I place a single cube (so, effectively the first only node in the scene) and do not scale with the number of nodes.

Hi

PointGraphs cannot detect new points defined by GameObjects automatically. This is because it’s not possible to discover these efficiently in Unity. So the point graph will only search for new GameObjects when scanning the graph.

  1. It looks like something is generating a lot of garbage. That lag spike is from the garbage collector running. Scanning a graph will generate some garbage, and in 4.2.x it will also run manually the GC after scanning. But likely this is not the cause of most of the garbage generated.