This code works fine in 2019.1 but OnInspectorGUI is no longer called in 2019.2
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(DefaultAsset))]
public class AssetPreview : Editor
{
private void OnEnable ()
{
string path = AssetDatabase.GetAssetPath(target);
Debug.Log("You have selected: " + path);
}
public override void OnInspectorGUI ()
{
Debug.Log("This should be called when any default asset is selected");
base.OnInspectorGUI();
}
}
I’ve submitted a bug report (1175246), but just wanted to know if anyone else has found this, or if something in Unity has been changed that I should be aware of.
Same problem here. My custom TextAsset editor stopped working. OnEnable, OnDisable, OnHeaderGUI are called, but not OnInspectorGUI
Unity have acknowledged it as a bug - hopefully will be fixed in the next release
Is there some kind of workaround for this? Forcing a call to OnInspectorGUI()
somehow? I tried calling it from OnHeaderGUI()
as GamerXP says it works, and it does do something, but other errors are thrown…
Edit:
I’ve just realised that the errors came due to another reason. Adding an override OnHeaderGUI()
and calling OnInspectorGUI()
from there is workaround for the Unity bug.
I have an asset that paints on scene, sometimes wont paint because seemingly the scene or inspector is not updated, could it be a similar to this bug issue ?
Thanks