ObjectField in GUILayout.Window Not Working - Returns None

Hi, I’m having a bit of difficulty pinpointing the a problem.

  1. I have an EditorWindow.
  2. Within that editor window I have GUIWindows.
  3. Within the GUIWindows I have objectFields.
  4. In the DoWindow function I have EditorGUIUtility.LookLikeControls(); and that makes the little selection button and object field show up.

The Problem:
When I click to select an object, the selection window opens fine, but when I do select an object, it still shows “None” in the ObjectField. This happens only while inside the GUIWindow().

Snippet below.

var animClip : AnimationClip;

function EntryWindow (windowID : int) {
animClip = EditorGUILayout.ObjectField("Animation Clip:", animClip, AnimationClip, true);

Any ideas what my problem can be?

It’s a bug.
You can draw this element above your window. It’a awful, but working.


Rect rect = new Rect();
AnimationClip clip;

void OnGUI()
   rect  = GUILayout.Window(i, rect , EntryWindow, "Hi There");
   clip= (Object)EditorGUI.ObjectField(rect,"Script", clip, typeof(AnimationClip), true);