Hi,
I get a null reference exception when calling the OnInspectorGUI on an editor created with Editor.CreateEditor.
The object passed inherit from UnityEngine.object and a custom editor is available.
How I create the editor :
public void OnEnable()
{
Actor = target as Actor;
HUDTargetData = Actor.HUDTargetData;
HUDTargetDataEditor = Editor.CreateEditor(HUDTargetData) as HUDTargetDataInspector;
}
And I get the error here :
public override void OnInspectorGUI()
{
ActorFoldout = EditorGUILayout.Foldout(ActorFoldout, "Actor");
if (ActorFoldout)
{
HUDTargetDataEditor.OnInspectorGUI(); // NullReferenceException: Object reference not set to an instance of an object
if (GUI.changed)
{
EditorUtility.SetDirty(target);
}
}
}