I’ve been trying for a while to draw fields for custom classes/structs.
Right now the only clue I have involves serializing the Editor itself :
[CustomEditor(typeof(Constellation))]
public class ConstellationEditor : Editor {
[SerializeField]StarLink captured; // custom Struct, NOT a property of the Editor's target.
public override void OnInspectorGUI () {
var obj = new SerializedObject (this);
EditorGUILayout.PropertyField (obj.FindProperty("captured"), true);
}
}
When doing so, the StarLink field does show in the inspector using its custom PropertyDrawer, but it appears disabled and it’s values can’t be edited.
I picked this solution from this thread about EditorWindows.Tried it for myself, and it does work flawlessly when using an EditorWindow instead of an inspector.