GUILayout.Label with Texture2D on the same line in Inspector ?
Hi,
I would like to show sprite in the inspector inside a scrollview, i can display them inside a GUILayout.Label but if i put more than one the other goes on another line.
I don t know how to put them next to another and change line when there is no more space.
I'm new with Unity, i tryied to google it but didn't found anything Here is the part of code:
(The multiple line of same label are just for test)
EditorGUILayout.BeginVertical();
scrollPos =
EditorGUILayout.BeginScrollView(scrollPos, GUILayout.MaxWidth(280), GUILayout.MaxHeight(150));
GUILayout.Label((Texture2D)(serializedObject.FindProperty("m_textureTest").objectReferenceValue), GUILayout.MaxWidth(64.0f), GUILayout.MaxHeight(64.0f));
GUILayout.Label((Texture2D)(serializedObject.FindProperty("m_textureTest").objectReferenceValue), GUILayout.MaxWidth(64.0f), GUILayout.MaxHeight(64.0f));
GUILayout.Label((Texture2D)(serializedObject.FindProperty("m_textureTest").objectReferenceValue), GUILayout.MaxWidth(64.0f), GUILayout.MaxHeight(64.0f));
GUILayout.Label((Texture2D)(serializedObject.FindProperty("m_textureTest").objectReferenceValue), GUILayout.MaxWidth(64.0f), GUILayout.MaxHeight(64.0f));
GUILayout.Label((Texture2D)(serializedObject.FindProperty("m_textureTest").objectReferenceValue), GUILayout.MaxWidth(64.0f), GUILayout.MaxHeight(64.0f));
GUILayout.Label((Texture2D)(serializedObject.FindProperty("m_textureTest").objectReferenceValue), GUILayout.MaxWidth(64.0f), GUILayout.MaxHeight(64.0f));
EditorGUILayout.EndScrollView();
EditorGUILayout.EndVertical();
Here what it looks like:
Thanks !
Answer by Jackain · Jul 26, 2016 at 11:11 AM
I've found by myself, i just need to use EditorGUILayout.BeginHorizontal(); and EditorGUILayout.EndHorizontal();
Your answer
Follow this Question
Related Questions
Project settings unavailable 0 Answers
Unity Editor Layout Problem 0 Answers
EditorGUILayout.EnumPopup shows always the same selected option but works as programmed 1 Answer
Access an Array of class inside another Array of class? (EditorGUILayout) 1 Answer
Custom Inspector changes not updating target in Edit Mode 1 Answer