Hi,
I’m trying to make a 9x9 grid of buttons in my editor window.
I can only make them go in one single row or collumn. How do I make a grid without using a selectiongrid as I need them to be buttons?
Thanks.
Nevermind I got it.
Heres the code if anyone in the future needs it.
for (int i = 0, x = 0; x < gridsize; x++)
{
GUILayout.EndVertical();
GUILayout.BeginHorizontal();
for (int y = 0; y < gridsize; y++)
{
GUILayout.Button(i.ToString(), GUILayout.Width(buttonSize), GUILayout.Height(buttonSize));
i++;
}
GUILayout.EndHorizontal();
GUILayout.BeginVertical();
}
1 Like