I managed to get this to work properly.
I had to change the following:
- Add layerIndex to the grid reorganization in UpdateGraphCoroutine
- Change UpdateNodePositionCollision to use logic from RecalculateCell. Send nodes by ref
- When adding a new layer, add it to a reference of nodes, not the grid’s nodes
- Change CalculateConnections to LayerGrid version
- After update all nodes in move function, set graph nodes to this array
- Call post stuff. Forget if this was necessary
I might have forgotten something but that was basically it. It can now scan procedural worlds with layers quickly.