How to move the centre of a graph during runtime?

I’ve been struggling this for a while now, and haven’t really found any good solutions for it online anywhere, does anyone know how to change the centre of a grid graph during runtime?

Hi

You can use GridGraph.RelocateNodes

1 Like

AstarPath.active.data.graphs[0].RelocateNodes(new Vector3(x, y, 0), Quaternion.identity, 1f, 1f, 0f);
I tried this but it just gives me an error saying no version of RelocateNodes has 5 overloads.

Hi

You must cast it to a GridGraph first. If you only have one grid graph in the scene you can use

AstarPath.active.data.gridGraph.RelocateNodes(...)

See also Documentation

1 Like