Function AstarPath.Snapshot

Snapshot (Bounds bounds, GraphMask graphMask)

Captures a snapshot of a part of the graphs, to allow restoring it later.

Public
GraphSnapshot Snapshot (

Bounds

bounds

GraphMask

graphMask

)

Captures a snapshot of a part of the graphs, to allow restoring it later.

This is useful if you want to do a graph update, but you want to be able to restore the graph to the previous state.

The snapshot will capture enough information to restore the graphs, assuming the world only changed within the given bounding box. This means the captured region may be larger than the bounding box.

Limitations:

  • Currently, the GridGraph and LayerGridGraph supports snapshots. Other graph types do not support it.

  • The graph must not change its dimensions or other core parameters between the time the snapshot is taken and the time it is restored.

  • Custom node connections may not be preserved. Unless they are added as off-mesh links using e.g. a NodeLink2 component.

  • The snapshot must not be captured during a work item, graph update or when the graphs are being scanned, as the graphs may not be in a consistent state during those times.

See

GraphUpdateUtilities.UpdateGraphsNoBlock, which uses this method internally.

NavGraph.Snapshot

Note

You must dispose the returned snapshot when you are done with it, to avoid leaking memory.