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

Adds a graph of type type to the graphs array.

Public
Awake ()

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

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
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 this instance holds.

Public
gridGraph

Shortcut to the first GridGraph.

Public
layerGridGraph

Shortcut to the first LayerGridGraph.

Public
navmesh

Shortcut to the first NavMeshGraph.

pointGraph

Shortcut to the first PointGraph.

Public
recastGraph

Shortcut to the first RecastGraph.

Public

Public Static Variables

active

Shortcut to AstarPath.active.

Public Static

Private/Protected Members

AddGraph (graph)

Adds the specified graph to the graphs array.

Private
AssertSafe (onlyAddingGraph=…)
Private
ClearGraphsInternal ()
Private
CreateGraph (type)

Creates a new graph instance of type type.

Internal
DeserializeGraphsPartAdditive (sr)

Helper function for deserializing graphs.

Private
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
data

Serialized data for all graphs and settings.

Private
dataString

Serialized data for all graphs and settings.

Private
graphStructureLocked
Private
upgradeData

Data from versions from before 3.6.1.

Private

Deprecated Members

AddGraph (type)

Adds a graph of type type to the graphs array.

Public
CreateGraph (type)

Creates a new instance of a graph of type type.

Public
GetGraphType (type)
Public
GetRaycastableGraphs ()

All graphs which implements the UpdateableGraph interface.

Public
data_cachedStartup

Serialized data for cached startup.

Public