Can't update ObjectField after object is selected

Hi!
I wanna create an editor window to control my waypoint system, and I need an ObjectField to be able to set an optional parent for all waypoints in the scene.
So, here’s the code of the class

using UnityEngine;
using System.Collections;
using UnityEditor;

public class WaypointBuilderWindow : EditorWindow {

    [MenuItem ("Custom Extensions/Waypoints Builder")]
    public static void  ShowWindow () {
        EditorWindow.GetWindow(typeof(WaypointBuilderWindow));
    }

	
	void OnGUI () {
        GUI.skin.label.wordWrap = true;
	    GUILayout.Label ("Here you can set the parent for all waypoints (optionally). If parent is not set, the root object will be used instead");
        GameObject gameObject = (GameObject)EditorGUILayout.ObjectField("Waypoint Container", null, typeof(GameObject), true);
        if (gameObject) {
            Debug.Log("Object Selected!");
        }
	}
	void OnInspectorUpdate() {
        Repaint();
    }
	
}

I also created an empty game object in my scene to set it as parent. But when I drag it to the object field, it just doesn’t update it with the name of the selected object (like it usually happens for public vars in the inspector).
The debug outputs “Object Selected!” normally and I can get a reference to this object, but the field remains unchanged visually

What am I missing here?

i have similar problem with you about the TextField, which cannot update with focus on it .