- Home /
Is it possible to make EditorGuiLayout.ObjectField(Texture2D) look like ObjectField(String,Texture2D)?
I'm currently creating a horizontal scrollbar in which all the layers of my terrain should be listed. Most importantly, their material should be easily recognizable by their main texture thumbnail. So far I've been using EditorGuiLayout.ObjectField(String,Texture2D), which gives me nice 80x80 thumbnails. Now I want to remove the label, because it's really just in the way in a horizontal scrollbar. But when I put in an empty label, I still have empty space to the left of my texture field, so that's no good. Now I went and used the EditorGuiLayout.ObjectField(Texture2D) and I don't get any empty spaces anymore, but now my textures no longer have a big thumbnail,but a very small field, like any other object would have. Is there a way to just draw the Texture without label but as a "big" field?
Answer by irilox · May 24, 2015 at 07:16 PM
This is an old post, but I stumbled on the same problem and found the solution. So I wanted to share it.
Adding "GUILayout.Width" and "GUILayout.Height" in the options of the Objectfield without label gives a big thumbnail
Answer by Fahv · Apr 13, 2015 at 01:08 PM
Did you try using?
EditorGUIUtility.labelWidth
Docs Page: http://docs.unity3d.com/ScriptReference/EditorGUIUtility-labelWidth.html
Try setting it to something low but not 0 as 0 resets the size to default.
Your answer
Follow this Question
Related Questions
Using treeview OnGUI with GUIlayout 0 Answers
Using GUI and GUILayout at the same time 1 Answer
Multiple Cars not working 1 Answer
Using an On-Screen GUI Button to show a GUI? 1 Answer
GUI Depth Sorting 1 Answer