Function RecastGraph.Resize

Resize (IntRect newTileBounds)

Resize the number of tiles that this graph contains.

Public
void Resize (

IntRect

newTileBounds

Rectangle of tiles that the graph should contain. Relative to the old bounds.

)

Resize the number of tiles that this graph contains.

This can be used both to make a graph larger, smaller or move the bounds of the graph around. The new bounds are relative to the existing bounds which are IntRect(0, 0, tileCountX-1, tileCountZ-1).

Any current tiles that fall outside the new bounds will be removed. Any new tiles that did not exist inside the previous bounds will be created as empty tiles. All other tiles will be preserved. They will stay at their current world space positions.

Note

This is intended to be used at runtime on an already scanned graph. If you want to change the bounding box of a graph like in the editor, use forcedBoundsSize and forcedBoundsCenter instead.

AstarPath.active.AddWorkItem(() => {
var graph = AstarPath.active.data.recastGraph;
var currentBounds = new IntRect(0, 0, graph.tileXCount-1, graph.tileZCount-1);

// Make the graph twice as large, but discard the first 3 columns.
// All other tiles will be kept and stay at the same position in the world.
// The new tiles will be empty.
graph.Resize(new IntRect(3, 0, currentBounds.xmax*2, currentBounds.ymax*2));
});