x


EditorGUI.ObjectField not working properly in a editor window?

I have this example code and if I click in "select" the browser opens fine, but the thumbnail doesn't change at all.

But if I drag the image directly it does.

Any idea what I an doing wrong? Is this a bug?

This is the code:

class GUIWindowDemo2 extends EditorWindow {
// The position of the window
var windowRect = Rect (10,10,400,300);

// Scroll position
var scrollPos = Vector2.zero;
var texture;
var texture2;

function OnGUI () {
// Set up a scroll view
scrollPos = GUI.BeginScrollView (
new Rect (0, 0, position.width, position.height),
scrollPos,
new Rect (0, 0, 400, 1000)
);

// Same code as before - make a window. Only now, it's INSIDE the scrollview
BeginWindows ();
windowRect = GUILayout.Window (1, windowRect, DoWindow, "Hi There");
EndWindows ();

// Close the scroll view
GUI.EndScrollView ();
}

function DoWindow () {
GUILayout.Button ("Hi");
//GUI.skin = null;
EditorGUIUtility.LookLikeControls(70, 30);
texture2 = EditorGUILayout.ObjectField("ne", texture2, typeof(Texture2D));
texture = EditorGUILayout.ObjectField("ne", texture2, typeof(Texture));
GUI.DragWindow ();

}

@MenuItem ("Test/GUIWindow Demo 2")
static function Init () {
EditorWindow.GetWindow (GUIWindowDemo2);
}
}
more ▼

asked Feb 04 '11 at 04:47 PM

SNoChE 1 gravatar image

SNoChE 1
1 2 2 2

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1663
x199
x69
x25

asked: Feb 04 '11 at 04:47 PM

Seen: 1537 times

Last Updated: Feb 04 '11 at 04:47 PM