Public Variables Not Displaying (CustomEditor)

I have a very simple editor/mono script combination that is baffling to me as to why it won’t show public variables. The mono script, which has been placed on an empty game object in the scene, has the following code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Organize : MonoBehaviour
{
    public List<GameObject> organized_parents = new List<GameObject>();

    public float shift_x = 15f, shift_z = 15f;
    public int maxChildrenInRow = 10;
}

The corresponding editor script, saved under the Assets/Editor folder, has this following code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(Organize))]
[CanEditMultipleObjects]
public class OrganizeEditorV2 : Editor
{
    public override void OnInspectorGUI()
    {
        if(GUILayout.Button("Click me"))
        {
            Debug.Log("Clicked");
        }
    }
}

Clicking the “Click Me” button (which shows up in the inspector) properly prints out that it was clicked. But the public variables in the mono script, the list, float, and int, do not appear in the inspector.

This is on unity version 2021.3.6f1 with the Universal Pipeline enabled if that matters…Is this a bug or have I done something wrong?

Hi,

It seems like overriding OnInspectorGUI() ignores any fields from base class, to fix this just add base.OnInspectorGUI(); at the start of the function.