- Home /
GUILayout vertical spacing
Hey,
how can i adjust the vertical spacing of elements arranged in a vertical gui layout.
e.g:
GUILayout.BeginVertical();
GUILayout.Label("alpha");
GUILayout.Label("beta");
GUILayout.Label("gamma");
GUILayout.EndVertical();
Answer by karl_ · Sep 04, 2011 at 07:19 PM
Use GUILayout.Space(x);
http://unity3d.com/support/documentation/ScriptReference/GUILayout.Space.html
Other options are passing a GUILayout.Height parameter (good to make columns of elements have the same total height), or using GUILayout.FlexibleSpace (good for sharing space evenly without explicit values).
Answer by LookWhatIDid · Mar 04, 2017 at 12:05 AM
Actually, use a negative value if you want to make the space smaller. I.E. GUILayout.Space(-10);
Odd huh? But it works.
Your answer
![](https://koobas.hobune.stream/wayback/20220612201737im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUI layering 0 Answers
Grid layout lags after thousand inserts. 0 Answers
How do I set the order of elements in Canvas (Screen Space - Camera)? 0 Answers
GUI button adjustments 2 Answers