- Home /
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); } }
Your answer
Follow this Question
Related Questions
Drawing Editor Inspector GUI based on selected/current prefab (CustomPropertyDrawer) 2 Answers
Custom Inspector Variables 1 Answer
Initialising List array for use in a custom Editor 1 Answer
custom editor EditorGUILayout.ObjectField only shows the assets folder 1 Answer
Custom Material Editor 1 Answer