A* Pathfinding Project  4.3.5
The A* Pathfinding Project for Unity 3D
AstarPathEditor Class Reference

Public Member Functions

void LoadGraphs ()
 Load graphs from serialized data. More...
 
void OnDisable ()
 Cleans up editor stuff. More...
 
void OnEnable ()
 Enables editor stuff. More...
 
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. More...
 

Static Public Member Functions

static void EditTags ()
 Opens the A* Inspector and shows the section for editing tags. More...
 
static System.Version FullyDefinedVersion (System.Version v)
 Returns a version with all fields fully defined. More...
 
static void MenuScan ()
 

Properties

static GUISkin astarSkin [get, private set]
 
System.Type [] graphTypes [get]
 
static GUIStyle helpBox [get, private set]
 
AstarPath script [get, private set]
 AstarPath instance that is being inspected. More...
 
static GUIStyle thinHelpBox [get, private set]
 

Private Member Functions

void AddGraph (System.Type type)
 
void CheckGraphEditors (bool forceRebuild=false)
 Make sure every graph has a graph editor. More...
 
void CreateFadeAreas ()
 
GraphEditor CreateGraphEditor (NavGraph graph)
 Creates a GraphEditor for a graph. More...
 
void DeserializeGraphs ()
 
void DeserializeGraphs (byte[] bytes)
 
void DrawAboutArea ()
 
void DrawColorSettings ()
 
void DrawDebugSettings ()
 
void DrawEditorSettings ()
 
void DrawGraph (GraphEditor graphEditor)
 Draws the inspector for the given graph with the given graph editor. More...
 
void DrawGraphHeader (GraphEditor graphEditor)
 
void DrawGraphInfoArea (GraphEditor graphEditor)
 
void DrawHeuristicOptimizationSettings ()
 
void DrawMainArea ()
 Draws the main area in the inspector. More...
 
void DrawOptimizationSettings ()
 Draws optimizations settings. More...
 
void DrawPathfindingSettings ()
 
void DrawSceneGUISettings ()
 
void DrawSerializationSettings ()
 
void DrawSettings ()
 
void DrawTagSettings ()
 
void FindGraphTypes ()
 Searches in the current assembly for GraphEditor and NavGraph types. More...
 
void GetAstarEditorSettings ()
 Reads settings frome EditorPrefs. More...
 
bool HandleUndo ()
 
void OnUndoRedoPerformed ()
 Called when an undo or redo operation has been performed. More...
 
void RemoveGraph (NavGraph graph)
 
void RepaintSceneView ()
 Repaints Scene View. More...
 
TextAsset SaveGraphData (byte[] bytes, TextAsset target=null)
 
void SerializeIfDataChanged ()
 
void SetAstarEditorSettings ()
 

Static Private Member Functions

static int ByteArrayHash (byte[] arr)
 Hashes the contents of a byte array. More...
 
static void DisableJs ()
 Disables JS support if it was enabled. More...
 
static void DrawColorSlider (ref float left, ref float right, bool editable)
 
static void EnableJs ()
 Enables JS support. More...
 
static bool IsJsEnabled ()
 Checks if JS support is enabled. More...
 
static bool LoadStyles ()
 Loads GUISkin and sets up styles. More...
 

Private Attributes

List< OptimizationHandler.DefineDefinitiondefines
 Holds defines found in script files, used for optimizations. More...
 
GraphEditor [] graphEditors
 List of all graph editors for the graphs. More...
 
GraphEditor graphNameFocused
 Graph editor which has its 'name' field focused. More...
 
const string scriptsFolder = "Assets/AstarPathfindingProject"
 

Static Private Attributes

static FadeArea aboutArea
 
static FadeArea addGraphsArea
 
static FadeArea alwaysVisibleArea
 
static FadeArea colorSettingsArea
 
static bool customAreaColorsOpen
 
static FadeArea editorSettingsArea
 
static bool editTags
 
static GUIStyle graphDeleteButtonStyle
 
static GUIStyle graphEditNameButtonStyle
 
static Dictionary< string, CustomGraphEditorAttributegraphEditorTypes = new Dictionary<string, CustomGraphEditorAttribute>()
 List of all graph editors available (e.g GridGraphEditor) More...
 
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. More...
 
static FadeArea graphsArea
 
static uint ignoredChecksum
 Used to make sure correct behaviour when handling undos. More...
 
static int lastUndoGroup = -1000
 
static GUIStyle level0AreaStyle
 
static GUIStyle level0LabelStyle
 
static GUIStyle level1AreaStyle
 
static GUIStyle level1LabelStyle
 
static FadeArea optimizationSettingsArea
 
static FadeArea serializationSettingsArea
 
static FadeArea settingsArea
 
static bool showSettings
 
static bool stylesLoaded
 
static FadeArea tagsArea
 

Member Function Documentation

◆ AddGraph()

void AddGraph ( System.Type  type)
private

◆ ByteArrayHash()

static int ByteArrayHash ( byte []  arr)
staticprivate

Hashes the contents of a byte array.

◆ CheckGraphEditors()

void CheckGraphEditors ( bool  forceRebuild = false)
private

Make sure every graph has a graph editor.

◆ CreateFadeAreas()

void CreateFadeAreas ( )
private

◆ CreateGraphEditor()

GraphEditor CreateGraphEditor ( NavGraph  graph)
private

Creates a GraphEditor for a graph.

◆ DeserializeGraphs() [1/2]

void DeserializeGraphs ( )
private

◆ DeserializeGraphs() [2/2]

void DeserializeGraphs ( byte []  bytes)
private

◆ DisableJs()

static void DisableJs ( )
staticprivate

Disables JS support if it was enabled.

This is done by restructuring folders in the project

◆ DrawAboutArea()

void DrawAboutArea ( )
private

◆ DrawColorSettings()

void DrawColorSettings ( )
private

◆ DrawColorSlider()

static void DrawColorSlider ( ref float  left,
ref float  right,
bool  editable 
)
staticprivate

◆ DrawDebugSettings()

void DrawDebugSettings ( )
private

◆ DrawEditorSettings()

void DrawEditorSettings ( )
private

◆ DrawGraph()

void DrawGraph ( GraphEditor  graphEditor)
private

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

◆ DrawGraphHeader()

void DrawGraphHeader ( GraphEditor  graphEditor)
private

◆ DrawGraphInfoArea()

void DrawGraphInfoArea ( GraphEditor  graphEditor)
private

◆ DrawHeuristicOptimizationSettings()

void DrawHeuristicOptimizationSettings ( )
private

◆ DrawMainArea()

void DrawMainArea ( )
private

Draws the main area in the inspector.

◆ DrawOptimizationSettings()

void DrawOptimizationSettings ( )
private

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

◆ DrawPathfindingSettings()

void DrawPathfindingSettings ( )
private

◆ DrawSceneGUISettings()

void DrawSceneGUISettings ( )
private

◆ DrawSerializationSettings()

void DrawSerializationSettings ( )
private

◆ DrawSettings()

void DrawSettings ( )
private

◆ DrawTagSettings()

void DrawTagSettings ( )
private

◆ EditTags()

static void EditTags ( )
static

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

◆ EnableJs()

static void EnableJs ( )
staticprivate

Enables JS support.

This is done by restructuring folders in the project.

See also
javascript

◆ FindGraphTypes()

void FindGraphTypes ( )
private

Searches in the current assembly for GraphEditor and NavGraph types.

◆ FullyDefinedVersion()

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

◆ GetAstarEditorSettings()

void GetAstarEditorSettings ( )
private

Reads settings frome EditorPrefs.

◆ HandleUndo()

bool HandleUndo ( )
private

◆ IsJsEnabled()

static bool IsJsEnabled ( )
staticprivate

Checks if JS support is enabled.

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

◆ LoadGraphs()

void LoadGraphs ( )

Load graphs from serialized data.

◆ LoadStyles()

static bool LoadStyles ( )
staticprivate

Loads GUISkin and sets up styles.

See also
EditorResourceHelper.LocateEditorAssets
Returns
True if all styles were found, false if there was an error somewhere

◆ MenuScan()

static void MenuScan ( )
static

◆ OnDisable()

void OnDisable ( )

Cleans up editor stuff.

◆ OnEnable()

void OnEnable ( )

Enables editor stuff.

Loads graphs, reads settings and sets everything up

◆ OnInspectorGUI()

override void OnInspectorGUI ( )

◆ OnSceneGUI()

void OnSceneGUI ( )

◆ OnUndoRedoPerformed()

void OnUndoRedoPerformed ( )
private

Called when an undo or redo operation has been performed.

◆ RemoveGraph()

void RemoveGraph ( NavGraph  graph)
private

◆ RepaintSceneView()

void RepaintSceneView ( )
private

Repaints Scene View.

Warning
Uses Undocumented Unity Calls (should be safe for Unity 3.x though)

◆ SaveGraphData()

TextAsset SaveGraphData ( byte []  bytes,
TextAsset  target = null 
)
private

◆ SaveGraphsAndUndo()

void SaveGraphsAndUndo ( EventType  et = EventType.Used,
string  eventCommand = "" 
)

◆ SerializeGraphs() [1/2]

byte [] SerializeGraphs ( out uint  checksum)

◆ SerializeGraphs() [2/2]

byte [] SerializeGraphs ( Pathfinding.Serialization.SerializeSettings  settings,
out uint  checksum 
)

◆ SerializeIfDataChanged()

void SerializeIfDataChanged ( )
private

◆ SetAstarEditorSettings()

void SetAstarEditorSettings ( )
private

◆ UseDefaultMargins()

override bool UseDefaultMargins ( )

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

Member Data Documentation

◆ aboutArea

FadeArea aboutArea
staticprivate

◆ addGraphsArea

FadeArea addGraphsArea
staticprivate

◆ alwaysVisibleArea

FadeArea alwaysVisibleArea
staticprivate

◆ colorSettingsArea

FadeArea colorSettingsArea
staticprivate

◆ customAreaColorsOpen

bool customAreaColorsOpen
staticprivate

◆ defines

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

◆ editorSettingsArea

FadeArea editorSettingsArea
staticprivate

◆ editTags

bool editTags
staticprivate

◆ graphDeleteButtonStyle

GUIStyle graphDeleteButtonStyle
staticprivate

◆ graphEditNameButtonStyle

GUIStyle graphEditNameButtonStyle
staticprivate

◆ graphEditors

GraphEditor [] graphEditors
private

List of all graph editors for the graphs.

◆ graphEditorTypes

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

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

◆ graphGizmoButtonStyle

GUIStyle graphGizmoButtonStyle
staticprivate

◆ graphInfoButtonStyle

GUIStyle graphInfoButtonStyle
staticprivate

◆ graphNameFocused

GraphEditor graphNameFocused
private

Graph editor which has its 'name' field focused.

◆ graphNodeCounts

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

◆ graphsArea

FadeArea graphsArea
staticprivate

◆ ignoredChecksum

uint ignoredChecksum
staticprivate

Used to make sure correct behaviour when handling undos.

◆ lastUndoGroup

int lastUndoGroup = -1000
staticprivate

◆ level0AreaStyle

GUIStyle level0AreaStyle
staticprivate

◆ level0LabelStyle

GUIStyle level0LabelStyle
staticprivate

◆ level1AreaStyle

GUIStyle level1AreaStyle
staticprivate

◆ level1LabelStyle

GUIStyle level1LabelStyle
staticprivate

◆ optimizationSettingsArea

FadeArea optimizationSettingsArea
staticprivate

◆ scriptsFolder

const string scriptsFolder = "Assets/AstarPathfindingProject"
private

◆ serializationSettingsArea

FadeArea serializationSettingsArea
staticprivate

◆ settingsArea

FadeArea settingsArea
staticprivate

◆ showSettings

bool showSettings
staticprivate

◆ stylesLoaded

bool stylesLoaded
staticprivate

◆ tagsArea

FadeArea tagsArea
staticprivate

Property Documentation

◆ astarSkin

GUISkin astarSkin
staticgetprivate set

◆ graphTypes

System.Type [] graphTypes
getprivate

◆ helpBox

GUIStyle helpBox
staticgetprivate set

◆ script

AstarPath script
getprivate set

AstarPath instance that is being inspected.

◆ thinHelpBox

GUIStyle thinHelpBox
staticgetprivate set

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