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<T> ()

Adds a graph of type T to the graphs array.

Public
AddGraph (type)

Adds a graph of type type to the graphs array.

Public
ClearGraphs ()

Destroys all graphs and sets graphs to null.

Public
DeserializeGraphs ()

Deserializes graphs from data.

Public
DeserializeGraphs (bytes)

Deserializes graphs from the specified byte array.

Public
DeserializeGraphsAdditive (bytes)

Deserializes graphs from the specified byte array additively.

Public
DisposeUnmanagedData ()
Public
FindGraph (predicate)

Returns the first graph which satisfies the predicate.

Public
FindGraphOfType (type)

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

Public
FindGraphTypes ()

Find all graph types supported in this build.

Public
FindGraphWhichInheritsFrom (type)

Returns the first graph which inherits from the type type.

Public
FindGraphsOfType (type)

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

Public
GetData ()
Public
GetGraphIndex (graph)

Gets the index of the NavGraph in the graphs array.

Public
GetNodes (callback)

Calls the callback with every node in all graphs.

Public
GetUpdateableGraphs ()

All graphs which implements the UpdateableGraph interface.

Public
LoadFromCache ()

Load from data from file_cachedStartup.

Public
OnDestroy ()
Public
OnEnable ()

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

Public
RemoveGraph (graph)

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

Public
SerializeGraphs ()

Serializes all graphs settings to a byte array.

Public
SerializeGraphs (settings)

Serializes all graphs settings and optionally node data to a byte array.

Public
SerializeGraphs (settings, checksum)

Main serializer function.

Public
SetData (data)
Public
UpdateShortcuts ()

Updates shortcuts to the first graph of different types.

Public

Public Static Methods

GetGraph (node)

Returns the graph which contains the specified node.

Public Static

Public Variables

cacheStartup

Should graph-data be cached.

Public
file_cachedStartup

Serialized data for cached startup.

Public
graphTypes

All supported graph types.

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
navmesh

Shortcut to the first NavMeshGraph.

pointGraph

Shortcut to the first PointGraph.

Public
recastGraph

Shortcut to the first RecastGraph.

Public

Private/Protected Members

AddGraph (graph)

Adds the specified graph to the graphs array.

Private
AssertSafe (onlyAddingGraph=…)
Private
AstarData (active)
Internal
ClearGraphsInternal ()
Private
CreateGraph (type)

Creates a new graph instance of type type.

Internal
DeserializeGraphsPartAdditive (sr)

Helper function for deserializing graphs.

Private
DestroyAllNodes ()

Makes all graphs become unscanned.

Internal
LockGraphStructure (allowAddingGraphs=…)

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

Internal
UnlockGraphStructure ()

Allows the graph structure to change again.

Internal
active

The AstarPath component which owns this AstarData.

Internal
data

Serialized data for all graphs and settings.

Private
dataString

Serialized data for all graphs and settings.

Private
graphStructureLocked
Private