- Home /
Lining up GUI
Hello hopefully someone can help me with my OCD problem really quick. It's probably something stupid but it is really bugging me. Why won't the buttons line up vertically with the rest of the controls?
![alt text][1]
My code:
EditorGUILayout.BeginHorizontal();
{
level = EditorGUILayout.Popup(level, levels, GUILayout.MaxWidth(150f));
EditorGUILayout.LabelField("Wave ", GUILayout.MaxWidth(50f));
wave = EditorGUILayout.IntField(wave, GUILayout.MaxWidth(25f));
if (GUILayout.Button("-", GUILayout.MaxWidth(25f)))
{
if (wave > 0)
{
wave--;
}
}
if (GUILayout.Button("+", GUILayout.MaxWidth(25f)))
{
wave++;
}
}
EditorGUILayout.EndHorizontal();
Thank you for your time and help! [1]: /storage/temp/20502-gui.png
Do you have anything in your GUILayout for Button that might have a pad, margin, Offset, etc?
I see now that GUILayout is not a skin you devised, its the default EditorGUI and I don't know about getting at its styles, sorry.
Answer by frarees · Jan 11, 2014 at 01:13 PM
Use EditorStyles.miniButton
. In your case you might like to use EditorStyles.miniButtonLeft
and EditorStyles.miniButtonRight
.
Thanks man! I don't know why the default GUI and EditorGUI styles don't match but this definitely works for my purposes. If anyone is interested it now looks like this:
Your answer
Follow this Question
Related Questions
Custom Editor GUI Elements 1 Answer
Editor GUI Foldout header style customization 0 Answers
EditorGUI like light explorer window 1 Answer
Custom Material Editor 1 Answer
Trigger an event from editor script? 0 Answers