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:

74856-test.png

Thanks !

I’ve found by myself, i just need to use EditorGUILayout.BeginHorizontal(); and EditorGUILayout.EndHorizontal();