Derive editor from GridGaphEditor?

So I have an overridden graph derived from GridGraph soley for the prupsoe of adding the following method:

    public override void UpdateNodePositionCollision(GridNode node, int x, int z, bool resetPenalty = true) {
        base.UpdateNodePositionCollision(node, x, z, resetPenalty);

        // no nodes below sealevel
        if (node.position.y <= Terrain.activeTerrain.seaLevel) {
            node.Walkable = false;
        }
    }

(btw, is that the correct way to do what I want?) Anyways…

I need to create the editor class so I can select this, but I want to be able to have all the optiosn from gridgraph. I tried this:

[CustomGraphEditor(typeof(TerrainGraph), "Terrain Graph")]
public class TerrainGraphEditor : GridGraphEditor {
    // Here goes the GUI
    public void OnInspectorGUI(TerrainGraph target) {
        base.OnBaseInspectorGUI((GridGraph)target);            
        //TerrainGraph graph = (TerrainGraph)target;
    }
}

But I get a the following exception when I add the graph:

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.GridGraphEditor.OnSceneGUI (Pathfinding.NavGraph target) (at Assets/ThirdParty/AstarPathfindingProject/Editor/GraphEditors/GridGeneratorEditor.cs:477)
AstarPathEditor.OnSceneGUI () (at Assets/ThirdParty/AstarPathfindingProject/Editor/AstarPathEditor.cs:858)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object parameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2056)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1405)
UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1242)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

Is it possible to do what I want to do? Better yet, is there a way to hook into the code that checks if a node is walkable without having to create a bunch of new classes?

EDIT:

So I fixed some stupid things I was doing (like not actually expanding the graph in the inspector), and I see everything from GridGraph. However I still have this exception whenever I view the inspector.

Hi

Yeah, this bug was reported very recently.
In fact I just uploaded 3.8.1 which fixes this bug.

Oh neat! I probably should have upgraded when it asked me today.

However for the problem that you are trying to solve, there is an easier way.

Use a standard grid graph, but make sure that the y coordinate for it is set to the sea level. Then make sure that “Unwalkable when no ground” under the height testing settings is set to true. The rays that it fires for height testing will not go below the y coordinate for the grid graph (i.e the sea level) and when it cannot find any ground, it will set the node to unwalkable.

I see. Thanks Aron! I gave it a shot and it is pretty much doing what I wanted. I do have two unusual problems though.

I am going to try upgrading first though. If that doe snot solve it i’ll make a seperate post.