Editor.OnSceneGUI never called

I’m trying to understand why OnEditorGUI is never called on my custom Editor subclass.

The code is as follow:

using UnityEngine;
using UnityEditor;
  
[CustomEditor(typeof(Bezier))]
public class BezierEditor : Editor
{
	public override void OnInspectorGUI ()
	{
		base.OnInspectorGUI ();
		Debug.Log("on inspector gui");
	}
	
	public void OnSceneGUI()
	{
		Debug.Log("on scene gui");
	}
}

OnInspectorGUI is properly called and the debug show for it, but not for OnSceneGUI. I’m using the latest Unity version 3.4.1f5

Not a definitive fix, but if it happens again you can reset the editor Layout with the top-right button (for instance to Default).

I had the same issue with my custom editor and a tilemap plugin that stopped displaying its the tiling tools. Closing and restarting the editor didn’t solve it. Resetting the layout solved it.

Turning the visibility of Gizmos on in the Scene view worked for me. I had turned them off for some reason and OnSceneGUI stopped being called.

Gizmo’s need to be enabled

OnSceneGui is not called if Gizmo’s are disabled…

I know it’s already 2023. But I meet the problem too! Unity-2021-3-LTS (2021.3.20f1)

After some debug, I think add the following code in inspector OnEnable() method will fix it:

// force dirty SceneView.s_ActiveEditors
// maybe this is a unity bug
var method = typeof(SceneView).GetMethod("SetActiveEditorsDirty", BindingFlags.NonPublic | BindingFlags.Static);
// ReSharper disable once PossibleNullReferenceException
method.Invoke(null, new object[]{true});

The truth is the new Inspector is not added to the SceneView.s_ActiveEditors list, so call this dirty method to refresh this list will fix this problem.

Old question. But maybe someone find same issue. When I have “DEBUG” enabled on Inspector, OnGUI does not work for me either. I must disable it.

I’m guessing it’s a bug, cause why it would stop working?