Hi,
I have a couple of buttons organized with begin horizontal but the problem is how do you get them to wrap around and start on the next line once they have hit the max width of declared in GUILayout.BeginArea?
The code below I have is my attempt at it but I get ArgumentException:GUILayout:Mismatched LayoutGroup.Repaint
But I dont think this is a good way about it anyway so does anyone have any suggestions? Really stumped…
void OnGUI() { float width = 200; // Wrap everything in the designated GUI Area GUILayout.BeginArea(new Rect(Screen.width / 4 - 50, Screen.height - 300, width, 700)); // Begin the singular Vertical Group GUILayout.BeginVertical(); GUILayout.Label("REPORT HEADER"); float w = 0; GUILayout.BeginHorizontal(); for (int i = 0; i < workSearchRef.workWordArray.Length; i++) { string word = workSearchRef.workWordArray*.word;* _if (workSearchRef.workWordArray*.isTarget)*_ _*{*_ _*if (GUILayout.Button(" " + word, Highlight))*_ _*{*_ _*print("button pressed");*_ _*}*_ _*}*_ _*else*_ _*{*_ _*GUILayout.Button(" " + word, Normal);*_ _*}*_ _*Rect rect = GUILayoutUtility.GetLastRect();*_ _*w += rect.width;*_ _*if (w >= width)*_ _*{*_ _*GUILayout.EndHorizontal();*_ _*GUILayout.BeginHorizontal();*_ _*w = 0;*_ _*}*_ _*}*_ _*GUILayout.EndHorizontal();*_ _*if (GUILayout.Button("Close"))*_ _*{*_ _*chairRef.closeWork();*_ _*}*_ _*GUILayout.EndVertical();*_ _*GUILayout.EndArea();*_ _*}*_ _*`*_ _*`*_