Created
February 15, 2016 09:35
-
-
Save Arakade/a4a2265c5ce07efd2b4a to your computer and use it in GitHub Desktop.
Part 2 of a patch for A* Project's AstarPathEditor that fixes sections guarded by #define ASTARDEBUG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Ast5870.tmp\\AstarPathEditor-25a36d5-left.cs" "b/D:\\Users\\User\\Dev\\Unity3D\\AIExperiments\\Assets\\AstarPathfindingProject\\Editor\\AstarPathEditor.cs" | |
index 2d23473..2e27f4b 100644 | |
--- "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Ast5870.tmp\\AstarPathEditor-25a36d5-left.cs" | |
+++ "b/D:\\Users\\User\\Dev\\Unity3D\\AIExperiments\\Assets\\AstarPathfindingProject\\Editor\\AstarPathEditor.cs" | |
@@ -1,3 +1,5 @@ | |
+#define ASTARDEBUG | |
+ | |
using UnityEngine; | |
using UnityEditor; | |
using System.Collections.Generic; | |
@@ -1744,15 +1746,16 @@ public class AstarPathEditor : Editor { | |
void FindGraphTypes () { | |
graphEditorTypes = new Dictionary<string,CustomGraphEditorAttribute> (); | |
+ string debugString = ""; | |
+ var graphList = new List<System.Type>(); | |
+ | |
var allAssemblies = System.AppDomain.CurrentDomain.GetAssemblies(); | |
foreach (var asm in allAssemblies) { | |
System.Type[] types = asm.GetTypes (); | |
- var graphList = new List<System.Type> (); | |
- | |
#if ASTARDEBUG | |
- string debugString = "Graph Types Found\n"; | |
+ debugString = "Graph Types Found\n"; | |
#endif | |
// Iterate through the assembly for classes which inherit from GraphEditor | |
@@ -1790,36 +1793,44 @@ public class AstarPathEditor : Editor { | |
script.astarData.FindGraphTypes (); | |
#if ASTARDEBUG | |
- asm = Assembly.GetAssembly (typeof(AstarPath)); | |
- types = asm.GetTypes (); | |
+ var problemFound = false; | |
+ foreach (var asm in allAssemblies) { | |
- // Not really required, but it's so fast so why not make a check and see if any graph types didn't have any editors | |
- foreach (System.Type type in types) { | |
+ System.Type[] types = asm.GetTypes(); | |
- System.Type baseType = type.BaseType; | |
- while (baseType != null) { | |
- if (System.Type.Equals ( baseType, typeof(NavGraph) )) { | |
+ // Not really required, but it's so fast so why not make a check and see if any graph types didn't have any editors | |
+ foreach (System.Type type in types) { | |
- bool alreadyFound = false; | |
- for (int i=0;i<graphList.Count;i++) { | |
- if (graphList[i] == type) { | |
- alreadyFound = true; | |
- break; | |
+ System.Type baseType = type.BaseType; | |
+ while (baseType != null) { | |
+ if (System.Type.Equals ( baseType, typeof(NavGraph) )) { | |
+ | |
+ bool alreadyFound = false; | |
+ for (int i=0;i<graphList.Count;i++) { | |
+ if (graphList[i] == type) { | |
+ alreadyFound = true; | |
+ break; | |
+ } | |
} | |
+ if (!alreadyFound) { | |
+ graphList.Add (type); | |
+ debugString += "-- "+type.Name+" was found, but it has no editor\n"; | |
+ problemFound = true; | |
+ } | |
+ break; | |
} | |
- if (!alreadyFound) { | |
- graphList.Add (type); | |
- debugString += "-- "+type.Name+" was found, but it has no editor\n"; | |
- } | |
- break; | |
- } | |
- baseType = baseType.BaseType; | |
+ baseType = baseType.BaseType; | |
+ } | |
} | |
} | |
- debugString += "\n"+script.astarData.graphTypes.Length+" in total\n"; | |
- Debug.Log ("Graph Editors:\n"+debugString); | |
+ debugString += "Graph Editors:\n\n" +script.astarData.graphTypes.Length+" in total\n"; | |
+ if (problemFound) { | |
+ Debug.LogWarning (debugString); | |
+ } else { | |
+ Debug.Log (debugString); | |
+ } | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment