However, with this script, I must ensure the Layer is Default for the NavmeshCut component (empty gameObject with a NavMeshCut). If I set it to “MyCustomLayerForNavGeneration”, I am getting error.
AstarPath.cs is configured to have LayerMask as “MyCustomLayerForNavGeneration” and nothing else (in Recast Graph).
Instantly Returning from TileHandlerEditTime.OnPostScan() seems to avoid the error during Scanning in Editor, so it must be due to the script.
The error:
(popup that says “There was an error when generating graphs, check the console for more info”)
Stacktrace:
There was an error generating the graphs:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.NullReferenceException: Object reference not set to an instance of an object
at Pathfinding.TileHandlerHelper.HandleOnEnableCallback (Pathfinding.NavmeshClipper obj) [0x00001] in C:\MyDrive\Vigor\Assets\AstarPathfindingProject\Navmesh\TileHandlerHelper.cs:107
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
— End of inner exception stack trace —
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004d] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:313
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229
at TileHandlerEditTime.OnPostScan (AstarPath astarPath) [0x00054] in C:\MyDrive\Vigor\Assets\AstarPathfindingProject\Core\TileHandlerEditTime.cs:34
at AstarPath+c__Iterator2.MoveNext () [0x00376] in C:\MyDrive\Vigor\Assets\AstarPathfindingProject\Core\AstarPath.cs:1606
at Pathfinding.AstarPathEditor.MenuScan () [0x000f2] in C:\MyDrive\Vigor\Assets\AstarPathfindingProject\Editor\AstarPathEditor.cs:1469
If you think this is a bug, please contact me on forum.arongranberg.com (post a new thread)
Followed by:
NullReferenceException: Object reference not set to an instance of an object
Pathfinding.TileHandlerHelper.HandleOnEnableCallback (Pathfinding.NavmeshClipper obj) (at Assets/AstarPathfindingProject/Navmesh/TileHandlerHelper.cs:107)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:305)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
Pathfinding.AstarPathEditor.MenuScan () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1480)
Pathfinding.AstarPathEditor.OnInspectorGUI () (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:285)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, System.Int32 editorIndex, System.Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1240)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)