- Home /
Question by
TimBorquez · Nov 25, 2013 at 06:14 AM ·
guionguiguilayouthorizontal
GUILayout, is there a way to bunch horizontal elements together?
I am trying to make selectable words that are buttons in between sentences that are labels
when i put them in guilayout it spaces them accross the entire guilayout like it's supposed to and puts big gaps in my sentences, any way around this?
sample:
GUILayout.BeginArea (Rect (Screen.height*.05, Screen.height*.15, Screen.height, Screen.height*.80));
GUILayout.BeginHorizontal ();
GUILayout.Label("This is a ");
GUILayout.Button ("test word");
GUILayout.Label("that you might want to ");
GUILayout.Button ("press.");
GUILayout.EndHorizontal ();
GUILayout.EndArea ();
Comment
Best Answer
Answer by numberkruncher · Nov 25, 2013 at 06:45 AM
The easy solution is to stick GUILayout.FlexibleSpace()
at the end:
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
The slightly less easy solution is to create custom GUIStyle
's where GUIStyle.stretchWidth
is set to false
:
http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle-stretchWidth.html
thank you both very much, i ended up doing the method of turning off stretch width because i am already using styles for them