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

Public Member Functions

void DrawOptimizationSettings ()
 Draws optimizations settings.
 
void LoadGraphs ()
 
void OnDisable ()
 Cleans up editor stuff.
 
void OnEnable ()
 Enables editor stuff.
 
override void OnInspectorGUI ()
 
void OnSceneGUI ()
 
void SaveGraphsAndUndo (EventType et=EventType.Used, string eventCommand="")
 
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 System.Version FullyDefinedVersion (System.Version v)
 Returns a version with all fields fully defined.
 
static bool LoadStyles ()
 Loads GUISkin and sets up styles.
 
static void MenuScan ()
 

Static Public Attributes

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 readonly string AstarProTooltip = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage,"
 
static string editorAssets = "Assets/AstarPathfindingProject/Editor/EditorAssets"
 Path to the editor assets folder for the A* Pathfinding Project.
 

Properties

static GUISkin astarSkin [get, set]
 
static GUIStyle downArrow [get, set]
 
System.Type[] graphTypes [get]
 
static GUIStyle helpBox [get, set]
 
AstarPath script [get, set]
 AstarPath instance that is being inspected.
 
static bool stylesLoaded [get, set]
 
static GUIStyle thinHelpBox [get, set]
 
static GUIStyle upArrow [get, set]
 

Private Member Functions

void AddGraph (System.Type type)
 
void CheckGraphEditors (bool forceRebuild=false)
 Make sure every graph has a graph editor.
 
GraphEditor CreateGraphEditor (string graphType)
 Creates a GraphEditor for a graph.
 
void DeserializeGraphs ()
 
void DeserializeGraphs (byte[] bytes)
 
void DrawAboutArea ()
 
void DrawColorSettings ()
 
void DrawDebugSettings ()
 
void DrawEditorSettings ()
 
void DrawFirstRun ()
 Draws the first run dialog.
 
bool DrawGraph (NavGraph graph, GraphEditor graphEditor)
 Draws the inspector for the given graph with the given graph editor.
 
void DrawHeuristicOptimizationSettings ()
 
void DrawMainArea ()
 Draws the main area in the inspector.
 
void DrawSerializationSettings ()
 
void DrawSettings ()
 
void DrawTagSettings ()
 
void FindGraphTypes ()
 Searches in the current assembly for GraphEditor and NavGraph types.
 
void GetAstarEditorSettings ()
 Reads settings frome EditorPrefs.
 
bool HandleUndo ()
 
void OnDrawGizmos ()
 Draw Editor Gizmos in graphs.
 
void OnUndoRedoPerformed ()
 Called when an undo or redo operation has been performed.
 
void RemoveGraph (NavGraph graph)
 
void RepaintSceneView ()
 Repaints Scene View.
 
TextAsset SaveGraphData (byte[] bytes, TextAsset target=null)
 
void SerializeIfDataChanged ()
 
void SetAstarEditorSettings ()
 
void UnloadGizmoMeshes ()
 Unloads any temporary meshes used for drawing gizmos to prevent memory leaks.
 

Static Private Member Functions

static int ByteArrayHash (byte[] arr)
 
static void DisableJs ()
 Disables JS support if it was enabled.
 
static void DiscardFirstRun ()
 Discards the first run window.
 
static void DrawColorSlider (ref float left, ref float right, bool editable)
 
static void EnableJs ()
 Enables JS support.
 
static bool IsJsEnabled ()
 Checks if JS support is enabled.
 
static bool LocateEditorAssets ()
 Locates the editor assets folder in case the user has moved it.
 

Private Attributes

AstarPath.AstarDistribution astarDistribution = AstarPath.AstarDistribution.AssetStore
 
List
< OptimizationHandler.DefineDefinition
defines
 Holds defines found in script files, used for optimizations.
 
GraphEditor[] graphEditors
 List of all graph editors for the graphs.
 
EditorGUILayoutx guiLayoutx
 
const string scriptsFolder = "Assets/AstarPathfindingProject"
 
bool showAddGraphMenu
 Is the 'Add New Graph' menu open.
 

Static Private Attributes

static bool aboutArea
 
static bool colorSettings
 
static bool customAreaColorsOpen
 
static bool editorSettings
 
static bool editTags
 
static bool firstRun = true
 Used to show notifications to the user the first time the system is used in a project.
 
static GUIStyle graphBoxStyle
 
static GUIStyle graphDeleteButtonStyle
 
static Dictionary< string,
CustomGraphEditorAttribute
graphEditorTypes = new Dictionary<string, CustomGraphEditorAttribute>()
 List of all graph editors available (e.g GridGraphEditor)
 
static GUIStyle graphGizmoButtonStyle
 
static GUIStyle graphInfoButtonStyle
 
static Dictionary< NavGraph,
KeyValuePair< float,
KeyValuePair< int, int > > > 
graphNodeCounts
 Holds node counts for each graph to avoid calculating it every frame.
 
static bool hasForcedNoDarkSkin
 True if the user is forcing dark skin to be used.
 
static uint ignoredChecksum
 Used to make sure correct behaviour when handling undos.
 
static int lastUndoGroup = -1000
 
static bool optimizationSettings
 
static bool showSerializationSettings
 
static bool showSettings
 
static GUIStyle topBoxHeaderStyle
 
static bool useDarkSkin
 Toggle to use a darker skin which matches the Unity Pro dark skin.
 

Member Function Documentation

void AddGraph ( System.Type  type)
private
static int ByteArrayHash ( byte[]  arr)
staticprivate
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.

void DeserializeGraphs ( )
private
void DeserializeGraphs ( byte[]  bytes)
private
static void DisableJs ( )
staticprivate

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

Draws the inspector for the given graph with the given graph editor.

void DrawHeuristicOptimizationSettings ( )
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
static void EditTags ( )
static

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

static void EnableJs ( )
staticprivate

Enables JS support.

This is done by restructuring folders in the project

void FindGraphTypes ( )
private

Searches in the current assembly for GraphEditor and NavGraph types.

static System.Version FullyDefinedVersion ( System.Version  v)
static

Returns a version with all fields fully defined.

This is used because by default new Version(3,0,0) > new Version(3,0). This is not the desired behaviour so we make sure that all fields are defined here

void GetAstarEditorSettings ( )
private

Reads settings frome EditorPrefs.

bool HandleUndo ( )
private
static bool IsJsEnabled ( )
staticprivate

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 bool LocateEditorAssets ( )
staticprivate

Locates the editor assets folder in case the user has moved it.

static void MenuScan ( )
static
void OnDisable ( )

Cleans up editor stuff.

void OnDrawGizmos ( )
private

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 ( )
void OnSceneGUI ( )
void OnUndoRedoPerformed ( )
private

Called when an undo or redo operation has been performed.

void RemoveGraph ( NavGraph  graph)
private
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 ( out uint  checksum)
byte [] SerializeGraphs ( Pathfinding.Serialization.SerializeSettings  settings,
out uint  checksum 
)
void SerializeIfDataChanged ( )
private
void SetAstarEditorSettings ( )
private
void UnloadGizmoMeshes ( )
private

Unloads any temporary meshes used for drawing gizmos to prevent memory leaks.

override bool UseDefaultMargins ( )

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

Member Data Documentation

bool aboutArea
staticprivate
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
readonly string AstarProTooltip = "A* Pathfinding Project Pro only feature\nThe Pro version can be bought on the A* Pathfinding Project homepage,"
static
bool colorSettings
staticprivate
bool customAreaColorsOpen
staticprivate
List<OptimizationHandler.DefineDefinition> defines
private

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 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
staticprivate
bool editTags
staticprivate
bool firstRun = true
staticprivate

Used to show notifications to the user the first time the system is used in a project.

GUIStyle graphBoxStyle
staticprivate
GUIStyle graphDeleteButtonStyle
staticprivate
GraphEditor [] graphEditors
private

List of all graph editors for the graphs.

Dictionary<string, CustomGraphEditorAttribute> graphEditorTypes = new Dictionary<string, CustomGraphEditorAttribute>()
staticprivate

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

GUIStyle graphGizmoButtonStyle
staticprivate
GUIStyle graphInfoButtonStyle
staticprivate
Dictionary<NavGraph, KeyValuePair<float, KeyValuePair<int, int> > > graphNodeCounts
staticprivate

Holds node counts for each graph to avoid calculating it every frame.

Only used for visualization purposes

EditorGUILayoutx guiLayoutx
private
bool hasForcedNoDarkSkin
staticprivate

True if the user is forcing dark skin to be used.

uint ignoredChecksum
staticprivate

Used to make sure correct behaviour when handling undos.

int lastUndoGroup = -1000
staticprivate
bool optimizationSettings
staticprivate
const string scriptsFolder = "Assets/AstarPathfindingProject"
private
bool showAddGraphMenu
private

Is the 'Add New Graph' menu open.

bool showSerializationSettings
staticprivate
bool showSettings
staticprivate
GUIStyle topBoxHeaderStyle
staticprivate
bool useDarkSkin
staticprivate

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

Property Documentation

GUISkin astarSkin
staticgetset
GUIStyle downArrow
staticgetset
System.Type [] graphTypes
getprivate
GUIStyle helpBox
staticgetset
AstarPath script
getset

AstarPath instance that is being inspected.

bool stylesLoaded
staticgetset
GUIStyle thinHelpBox
staticgetset
GUIStyle upArrow
staticgetset

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