Having trouble understanding the basics of custom inspector gui editing (spacing of elements)...

I’m having a hard time grasping the very basics of creating a custom gui for one of my inspectors.

Here’s what I’m not getting:

EditorGUILayout.BeginHorizontal ();

EditorGUILayout.LabelField ("hello");
EditorGUILayout.LabelField ("hello");

EditorGUILayout.EndHorizontal();

Creates this:

But how do I create this?


(photoshopped)

It’s nearly impossible to get those labels to move it seems.

With EditorGUILayout.LabelField, you can assign its layout options to be a certain width if you want. So you can try:

EditorGUILayout.LabelField ("Hello", GUILayout.Width (50));
// Or
EditorGUILayout.LabelField ("Hello", GUILayout.FlexibleSpace ());
1 Like

Thanks dj. I was trying something like:
GUIStyle labelStyle = new GUIStyle(GUI.skin.label);

and then using the value labelStyle with mixed results before displaying.

P.S - the flexiblespace method isn’t working for me