Class AstarData

Public

Stores the navigation graphs for the A* Pathfinding System.

An instance of this class is assigned to AstarPath.data. From it you can access all graphs loaded through the graphs variable. This class also handles a lot of the high level serialization.

Public Methods

AddGraph ([...])

Adds...

Destroys all graphs and sets graphs to null.

Deserializes...

Deserializes and loads graphs from the specified byte array additively.

DuplicateGraph (graph)

Duplicates the given graph and adds the duplicate to the graphs array.

FindGraph (predicate)

Returns the first graph which satisfies the predicate.

Returns the first graph of type type found in the graphs array.

Find all graph types supported in this build.

Returns the first graph which inherits from the type type.

Loop through this function to get all graphs of type 'type'.

GetData ()

Get the serialized data for all graphs and their settings.

GetGraphIndex (graph)

Gets the index of the graph in the graphs array.

GetNodes (callback)

Calls the callback with every node in all graphs.

All graphs which implements the UpdateableGraph interface.

Load from data from file_cachedStartup.

Loads the graphs from memory, will load cached graphs if any exists.

RemoveGraph (graph)

Removes the specified graph from the graphs array and Destroys it in a safe manner.

SerializeGraphs ([...])

...

SetData (data)

Set the serialized data for all graphs and their settings.

Updates shortcuts to the first graph of different types.

Public Static Methods

GetGraph (node)

Graph which contains the specified node.

Public Variables

cacheStartup

Should graph-data be cached.

Public
file_cachedStartup

Serialized data for cached startup.

Public
graphs

All graphs.

Public
gridGraph

Shortcut to the first GridGraph.

Public
layerGridGraph

Shortcut to the first LayerGridGraph.

Public
linkGraph

Shortcut to the first LinkGraph.

Public
navmeshGraph

Shortcut to the first NavMeshGraph.

pointGraph

Shortcut to the first PointGraph.

Public
recastGraph

Shortcut to the first RecastGraph.

Public

Public Static Variables

graphTypes

All supported graph types.

Public Static

Private/Protected Members

AssertSafe (onlyAddingGraph=…)
AstarData (active)
CreateGraph (type)

Creates a new graph instance of type type.

Helper function for deserializing graphs.

Makes all graphs become unscanned.

LockGraphStructure (allowAddingGraphs=…)

Prevent the graph structure from changing during the time this lock is held.

MarkerDeserializeGraphs
Private Static Readonly
MarkerFindGraphTypes
Private Static Readonly
MarkerLoadFromCache
Private Static Readonly
MarkerSerializeGraphs
Private Static Readonly

Allows the graph structure to change again.

active

The AstarPath component which owns this AstarData.

Private
data

Serialized data for all graphs and settings.

Private
dataString

Serialized data for all graphs and settings.

Private
graphStructureLocked
Private

Deprecated Members

navmesh

Shortcut to the first NavMeshGraph.