A* Pathfinding Project  3.6.2
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
AstarPathEditor Class Reference

Classes

class  UpdateChecker
 Checking for updates on startup. More...
 

Public Member Functions

void AddGraph (System.Type type)
 
void DeserializeGraphs ()
 
void DeserializeGraphs (byte[] bytes)
 
void DisableJs ()
 Disables JS support if it was enabled.
 
void DrawOptimizationSettings ()
 Draws optimizations settings.
 
void EnableJs ()
 Enables JS support.
 
void FindGraphTypes ()
 Searches in the current assembly for GraphEditor and NavGraph types.
 
void LoadGraphs ()
 
void OnDestroy ()
 
void OnDisable ()
 Cleans up editor stuff.
 
void OnDrawGizmos ()
 Draw Editor Gizmos in graphs.
 
void OnEnable ()
 Enables editor stuff.
 
override void OnInspectorGUI ()
 
void OnSceneGUI ()
 
void RemoveGraph (NavGraph graph)
 
void SaveGraphsAndUndo (EventType et=EventType.Used, string eventCommand="")
 
byte[] SerializeGraphs ()
 
byte[] SerializeGraphs (out uint checksum)
 
byte[] SerializeGraphs (Pathfinding.Serialization.SerializeSettings settings, out uint checksum)
 
override bool UseDefaultMargins ()
 Tell Unity that we want to use the whole inspector width.
 

Static Public Member Functions

static void EditTags ()
 Opens the A* Inspector and shows the section for editing tags.
 
static string GetURL (string tag)
 
static string GetURL (string tag, string defaultURL)
 
static bool IsJsEnabled ()
 Checks if JS support is enabled.
 
static bool LoadStyles ()
 Loads GUISkin and sets up styles.
 
static void MenuScan ()
 
static void RefreshServerMessage ()
 
static void UpdateCheckLoop ()
 Checking for updates on startup.
 

Public Attributes

List< DefineObjectdefines
 Holds defines found in script files, used for optimizations.
 
GraphEditor[] graphEditors
 List of all graph editors for graphs attached.
 
EditorGUILayoutx GUILayoutx
 
AstarPath script
 

Static Public Attributes

static string alternativeEditorAssets = "Assets/AstarPathfindingEditor/Editor/EditorAssets"
 Alternative path to the editor assets folder for the A* Pathfinding Project.
 
static bool askForDarkSkin = false
 If the dark skin is detected, show a popup asking if the dark skin should be used.
 
static readonly string AstarProButton = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage, click here for info"
 
static string astarProInfoURL = "http://arongranberg.com/unity/a-pathfinding/astarpro/"
 URL to more info about the A* Pathfinding Project.
 
static readonly string AstarProTooltip = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage,"
 
static Dictionary< string, string > astarServerData
 Holds various URLs and text for the editor.
 
static GUISkin astarSkin
 
static string documentationURL = "http://arongranberg.com/astar/docs/"
 URL to the documentation of the A* Pathfinding Project.
 
static GUIStyle downArrow
 
static string editorAssets = "Assets/AstarPathfindingProject/Editor/EditorAssets"
 Path to the editor assets folder for the A* Pathfinding Project.
 
static bool firstRun = true
 
static GUIStyle graphBoxStyle
 
static GUIStyle graphDeleteButtonStyle
 
static Dictionary< string,
CustomGraphEditor
graphEditorTypes = new Dictionary<string,CustomGraphEditor> ()
 List of all graph editors available (e.g GridGraphEditor)
 
static GUIStyle graphGizmoButtonStyle
 
static GUIStyle graphInfoButtonStyle
 
static Dictionary< NavGraph,
KeyValuePair< float,
KeyValuePair< int, int > > > 
graphNodeCounts
 
static bool hasForcedNoDarkSkin = false
 True if the user answered No on askForDarkSkin.
 
static GUIStyle helpBox
 
static System.Version latestAstarVersion
 Latest version of the A* Pathfinding Project.
 
static string latestAstarVersionDesc
 Description of the latest update of the A* Pathfinding Project.
 
static string ModifierHelpURL = "http://www.arongranberg.com/astar/docs/modifiers.php"
 URL to a page with more info on modifiers.
 
static bool refreshedServerData = false
 False if astarServerData has not yet been updated with latest data.
 
static string scriptsFolder = "Assets/AstarPathfindingProject"
 
static
Pathfinding.Serialization.SerializeSettings 
serializationSettings = Pathfinding.Serialization.SerializeSettings.All
 
static bool showSerializationSettings = false
 
static bool stylesLoaded = false
 
static GUIStyle thinHelpBox
 
static GUIStyle topBoxHeaderStyle
 
static GUIStyle upArrow
 
static WWW updateCheckObject
 
static double updateCheckRate = 1F
 
static string updateURL = "http://www.arongranberg.com/astar/version.php"
 URL to the version file containing the latest version number.
 
static bool useDarkSkin = false
 Toggle to use a darker skin which matches the Unity Pro dark skin.
 

Properties

System.Type[] graphTypes [get]
 
static System.DateTime lastUpdateCheck [get, set]
 

Private Member Functions

int ByteArrayHash (byte[] arr)
 
void CheckGraphEditors (bool forceRebuild=false)
 Make sure every graph has a graph editor.
 
GraphEditor CreateGraphEditor (string graphType)
 Creates a GraphEditor for a graph.
 
int CreateNewUserConnection (Vector3 start, Vector3 end)
 Creates a link between start and end.
 
void DrawAboutArea ()
 
void DrawColorSettings ()
 
void DrawDebugSettings ()
 
void DrawEditorSettings ()
 
void DrawFirstRun ()
 Draws the first run dialog.
 
bool DrawGraph (NavGraph graph, GraphEditor graphEditor)
 
void DrawLinkSettings ()
 
void DrawMainArea ()
 Draws the main area in the inspector.
 
void DrawSerializationSettings ()
 
void DrawSettings ()
 
void DrawTagSettings ()
 
void DrawUserConnections ()
 
void DrawUserConnectionsWindow ()
 
void GetAstarEditorSettings ()
 Reads settings frome EditorPrefs.
 
bool HandleUndo ()
 
UndoPropertyModification[] OnPostProcessModifications (UndoPropertyModification[] mods)
 
void OnUndoRedoPerformed ()
 Called when an undo or redo operation has been performed.
 
void OnWillFlushUndoRecord ()
 
void RemoveConnection (UserConnection conn)
 Removes user connection conn from the script.astarData.userConnections array.
 
void RepaintSceneView ()
 Repaints Scene View.
 
TextAsset SaveGraphData (byte[] bytes, TextAsset target=null)
 
void SerializeIfDataChanged ()
 
void SetAstarEditorSettings ()
 

Static Private Member Functions

static bool CheckForUpdates ()
 Checks for updates if there was some time since last check.
 
static void DiscardFirstRun ()
 Discards the first run window.
 
static void DrawColorSlider (ref float left, ref float right, bool editable)
 
static void ParseServerMessage (string result)
 
static void UpdateCheckCompleted (string result)
 Handles the data from the update page.
 

Private Attributes

AstarPath.AstarDistribution astarDistribution = AstarPath.AstarDistribution.AssetStore
 
GraphNode firstShiftNode
 
int selectedUserConnection = -1
 
bool showAddGraphMenu = false
 Is the 'Add New Graph' menu open.
 

Static Private Attributes

static System.DateTime _lastUpdateCheck
 
static bool _lastUpdateCheckRead = false
 
static bool aboutArea = false
 
static bool colorSettings = false
 
static bool customAreaColorsOpen = false
 
static bool editLinks = false
 
static bool editorSettings = false
 
static bool editTags = false
 
static uint ignoredChecksum = 0
 
static int lastUndoGroup = -1000
 
static bool linkSettings = false
 
static bool optimizationSettings = false
 
static bool showSettings = false
 

Member Function Documentation

void AddGraph ( System.Type  type)
int ByteArrayHash ( byte[]  arr)
private
static bool CheckForUpdates ( )
staticprivate

Checks for updates if there was some time since last check.

Usually called from OnInspectorGUI. It must be called repeatedly to ensure that the result is processed.

Returns
True if an update check is progressing (WWW request)
void CheckGraphEditors ( bool  forceRebuild = false)
private

Make sure every graph has a graph editor.

GraphEditor CreateGraphEditor ( string  graphType)
private

Creates a GraphEditor for a graph.

int CreateNewUserConnection ( Vector3  start,
Vector3  end 
)
private

Creates a link between start and end.

See Also
AstarData.userConnections
void DeserializeGraphs ( )
void DeserializeGraphs ( byte[]  bytes)
void DisableJs ( )

Disables JS support if it was enabled.

This is done by restructuring folders in the project

static void DiscardFirstRun ( )
staticprivate

Discards the first run window.

It will not be shown for this project again

void DrawAboutArea ( )
private
void DrawColorSettings ( )
private
static void DrawColorSlider ( ref float  left,
ref float  right,
bool  editable 
)
staticprivate
void DrawDebugSettings ( )
private
void DrawEditorSettings ( )
private
void DrawFirstRun ( )
private

Draws the first run dialog.

Asks if the user wants to enable JS support

bool DrawGraph ( NavGraph  graph,
GraphEditor  graphEditor 
)
private
void DrawLinkSettings ( )
private
void DrawMainArea ( )
private

Draws the main area in the inspector.

void DrawOptimizationSettings ( )

Draws optimizations settings.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here
void DrawSerializationSettings ( )
private
void DrawSettings ( )
private
void DrawTagSettings ( )
private
void DrawUserConnections ( )
private
void DrawUserConnectionsWindow ( )
private
static void EditTags ( )
static

Opens the A* Inspector and shows the section for editing tags.

void EnableJs ( )

Enables JS support.

This is done by restructuring folders in the project

void FindGraphTypes ( )

Searches in the current assembly for GraphEditor and NavGraph types.

void GetAstarEditorSettings ( )
private

Reads settings frome EditorPrefs.

static string GetURL ( string  tag)
static
static string GetURL ( string  tag,
string  defaultURL 
)
static
bool HandleUndo ( )
private
static bool IsJsEnabled ( )
static

Checks if JS support is enabled.

This is done by checking if the directory 'Assets/AstarPathfindingEditor/Editor' exists

void LoadGraphs ( )
static bool LoadStyles ( )
static

Loads GUISkin and sets up styles.

See Also
editorAssets
Returns
True if all styles were found, false if there was an error somewhere
static void MenuScan ( )
static
void OnDestroy ( )
void OnDisable ( )

Cleans up editor stuff.

void OnDrawGizmos ( )

Draw Editor Gizmos in graphs.

This is called using a delegate OnDrawGizmosCallback in the AstarPath script.

void OnEnable ( )

Enables editor stuff.

Loads graphs, reads settings and sets everything up

override void OnInspectorGUI ( )
UndoPropertyModification [] OnPostProcessModifications ( UndoPropertyModification[]  mods)
private
void OnSceneGUI ( )
void OnUndoRedoPerformed ( )
private

Called when an undo or redo operation has been performed.

void OnWillFlushUndoRecord ( )
private
static void ParseServerMessage ( string  result)
staticprivate
static void RefreshServerMessage ( )
static
void RemoveConnection ( UserConnection  conn)
private

Removes user connection conn from the script.astarData.userConnections array.

void RemoveGraph ( NavGraph  graph)
void RepaintSceneView ( )
private

Repaints Scene View.

Warning
Uses Undocumented Unity Calls (should be safe for Unity 3.x though)
TextAsset SaveGraphData ( byte[]  bytes,
TextAsset  target = null 
)
private
void SaveGraphsAndUndo ( EventType  et = EventType.Used,
string  eventCommand = "" 
)
byte [] SerializeGraphs ( )
byte [] SerializeGraphs ( out uint  checksum)
byte [] SerializeGraphs ( Pathfinding.Serialization.SerializeSettings  settings,
out uint  checksum 
)
void SerializeIfDataChanged ( )
private
void SetAstarEditorSettings ( )
private
static void UpdateCheckCompleted ( string  result)
staticprivate

Handles the data from the update page.

static void UpdateCheckLoop ( )
static

Checking for updates on startup.

Repeatedly called by #UpdateChecker

override bool UseDefaultMargins ( )

Tell Unity that we want to use the whole inspector width.

Member Data Documentation

System.DateTime _lastUpdateCheck
staticprivate
bool _lastUpdateCheckRead = false
staticprivate
bool aboutArea = false
staticprivate
string alternativeEditorAssets = "Assets/AstarPathfindingEditor/Editor/EditorAssets"
static

Alternative path to the editor assets folder for the A* Pathfinding Project.

Deprecated:
bool askForDarkSkin = false
static

If the dark skin is detected, show a popup asking if the dark skin should be used.

AstarPath.AstarDistribution astarDistribution = AstarPath.AstarDistribution.AssetStore
private
readonly string AstarProButton = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage, click here for info"
static
string astarProInfoURL = "http://arongranberg.com/unity/a-pathfinding/astarpro/"
static

URL to more info about the A* Pathfinding Project.

Deprecated:
readonly string AstarProTooltip = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage,"
static
Dictionary<string,string> astarServerData
static
Initial value:
= new Dictionary<string, string> {
{"URL:modifiers","http://www.arongranberg.com/astar/docs/modifiers.php"},
{"URL:astarpro","http://arongranberg.com/unity/a-pathfinding/astarpro/"},
{"URL:documentation","http://arongranberg.com/astar/docs/"},
{"URL:findoutmore","http://arongranberg.com/astar"},
{"URL:download","http://arongranberg.com/unity/a-pathfinding/download"},
{"URL:cRecastHelp","http://www.arongranberg.com/astar/docs/class_pathfinding_1_1_recast_graph.php#a2d3655da3ed281674cf5125205e2a246"},
{"URL:changelog","http://arongranberg.com/astar/docs/changelog.php"},
{"URL:tags","http://arongranberg.com/astar/docs/tags.php"},
{"URL:homepage","http://arongranberg.com/astar/"}
}

Holds various URLs and text for the editor.

This info can be updated when a check for new versions is done to ensure that there are no invalid links.

GUISkin astarSkin
static
bool colorSettings = false
staticprivate
bool customAreaColorsOpen = false
staticprivate
List<DefineObject> defines

Holds defines found in script files, used for optimizations.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here
string documentationURL = "http://arongranberg.com/astar/docs/"
static

URL to the documentation of the A* Pathfinding Project.

Deprecated:
GUIStyle downArrow
static
bool editLinks = false
staticprivate
string editorAssets = "Assets/AstarPathfindingProject/Editor/EditorAssets"
static

Path to the editor assets folder for the A* Pathfinding Project.

If this path turns out to be incorrect, the script will try to find the correct path

See Also
LoadStyles
bool editorSettings = false
staticprivate
bool editTags = false
staticprivate
bool firstRun = true
static
GraphNode firstShiftNode
private
GUIStyle graphBoxStyle
static
GUIStyle graphDeleteButtonStyle
static
GraphEditor [] graphEditors

List of all graph editors for graphs attached.

Dictionary<string,CustomGraphEditor> graphEditorTypes = new Dictionary<string,CustomGraphEditor> ()
static

List of all graph editors available (e.g GridGraphEditor)

GUIStyle graphGizmoButtonStyle
static
GUIStyle graphInfoButtonStyle
static
Dictionary<NavGraph,KeyValuePair<float,KeyValuePair<int,int> > > graphNodeCounts
static
EditorGUILayoutx GUILayoutx
bool hasForcedNoDarkSkin = false
static

True if the user answered No on askForDarkSkin.

GUIStyle helpBox
static
uint ignoredChecksum = 0
staticprivate
int lastUndoGroup = -1000
staticprivate
System.Version latestAstarVersion
static

Latest version of the A* Pathfinding Project.

string latestAstarVersionDesc
static

Description of the latest update of the A* Pathfinding Project.

bool linkSettings = false
staticprivate
string ModifierHelpURL = "http://www.arongranberg.com/astar/docs/modifiers.php"
static

URL to a page with more info on modifiers.

Deprecated:
bool optimizationSettings = false
staticprivate
bool refreshedServerData = false
static

False if astarServerData has not yet been updated with latest data.

The data is got from the server on system update checks, it is cached in editor prefs.

AstarPath script
string scriptsFolder = "Assets/AstarPathfindingProject"
static
int selectedUserConnection = -1
private
bool showAddGraphMenu = false
private

Is the 'Add New Graph' menu open.

bool showSerializationSettings = false
static
bool showSettings = false
staticprivate
bool stylesLoaded = false
static
GUIStyle thinHelpBox
static
GUIStyle topBoxHeaderStyle
static
GUIStyle upArrow
static
WWW updateCheckObject
static
double updateCheckRate = 1F
static
string updateURL = "http://www.arongranberg.com/astar/version.php"
static

URL to the version file containing the latest version number.

Deprecated:
bool useDarkSkin = false
static

Toggle to use a darker skin which matches the Unity Pro dark skin.

Property Documentation

System.Type [] graphTypes
get
System.DateTime lastUpdateCheck
staticgetset

The documentation for this class was generated from the following file: