I want to write a custom editor script to allow me to edit a mesh in scene view (I have written MonoBehaviour that does it in Game mode, so I figure there is a way to do it in Edit mode ).
I’m making progress, but the documentation is sparse and the going it tough.
Part of the problem is, I don’t formally understand what the typeof parameter means in the [CustomEditor(typeof( some class? ))] declaration. (is this extending the Editors control over instances of those objects, or classes, or inheriting from them, or what?)
I see the example in the documentation: [CustomEditor(typeof(Handle))] but cannot make sense of the parameter is supposed to do and what it is for. (I understand what the keyword typeof means - that is not the issue).
For example, First up: get a click on my mesh in scene view. I cobbled this script together from gems found on the Web:
[CustomEditor(typeof(GameObject))]
public class HexMapEditor : Editor {
public void OnSceneGUI()
{
Event e = Event.current;
int controlID = GUIUtility.GetControlID (FocusType.Passive);
switch (e.GetTypeForControl (controlID)) {
case EventType.MouseDown:
if( e.button == 0 ){
Debug.Log("Left MouseDown > " + controlID + " > " + e.mousePosition);
}else if( e.button == 1 ){
Debug.Log("Right MouseDown > " + controlID + " > " + e.mousePosition);
}else if( e.button == 2 ){
Debug.Log("Middle MouseDown > " + controlID + " > " + e.mousePosition);
}
break;
}
}
And it only works - I get my clicks - when the value is ‘GameObject’ [CustomEditor(typeof(GameObject ))]
However, when I implement this code, the Inspector changes - the ‘Active’ checkbox and menus at the top of the inspector are gone, and replaced with this:

I implicitly understand why this happened, but that the same time it makes me want to poke my eyes out with a stick.
I would have thought the Custom editor should be a typeof(SceneView) is what I should use, but if I use that value, the clicks don’t register in my script
Does anyone have some insight they can lend me, a good tutorial that explains any of this, and/or how I else I can detect clicks on my mesh in Editor mode - or what the best, better or another way of doing this is?
Thanks in advance!