Automatic Wrap

Hi all,
I generates the buttons in a loop.
I would like the buttons that automatically put a newline.
But I do not know how …

alt text
The code (example):

private void flapWindow(int ID){

GUILayout.BeginHorizontal()

foreach(KeyValuePair<string, Vector3> kvp in goToPos){

    if( GUILayout.Button(kvp.Key))goTo(kvp.Value);

}

GUILayout.EndHorizontal();

}

The problem is that the window expands in width but the text is not to new line …strong text

At a guess, you need to begin and end groups within your foreach loop :

private void flapWindow(int ID){

    foreach(KeyValuePair<string, Vector3> kvp in goToPos)
    {
        GUILayout.BeginHorizontal();
        if( GUILayout.Button(kvp.Key))goTo(kvp.Value);
        GUILayout.EndHorizontal();
    }
}

little up ?