- Home /
Question by
z3nth10n · Dec 20, 2014 at 11:56 PM ·
c#buttonseditorwindowlayout
Avoid new lines between elements inside a EditorWindow
Hi, I want to know how can I avoid buttons be placed on new lines:
public class ItemCreator : EditorWindow
{
[MenuItem("Window/Creador de Items")]
void OnGUI() {
GUILayout.Button("+", GUILayout.Width(40), GUILayout.Height(40));
GUILayout.Button("+", GUILayout.Width(40), GUILayout.Height(40));
GUILayout.Button("+", GUILayout.Width(40), GUILayout.Height(40));
//....
}
}
How can I display them on the same line?
Thanks in advance.
Bye. :)
Comment
Best Answer
Answer by RudyTheDev · Dec 21, 2014 at 12:51 PM
EditorGUILayout.BeginHorizontal();
GUILayout.Button("+", GUILayout.Width(40), GUILayout.Height(40));
GUILayout.Button("+", GUILayout.Width(40), GUILayout.Height(40));
GUILayout.Button("+", GUILayout.Width(40), GUILayout.Height(40));
EditorGUILayout.EndHorizontal();