I’m having an issue where I can’t place my button in a grid layout. It’s my first editor, so it might be something basic that I don’t understand.
I’ve been trying to make it work with GUILayout.BeginHorizontal(); but it just won’t work I don’t know what I’m doing wrong.
Here’s my custom window editor right now, I’d like my buttons to be ordered in a grid layout.
Here’s the code where I’m drawing my buttons, I call this in the OnGUI() method.
private bool DrawButtonObject(Object obj, string pathStartingFromResourcesFolder, int number)
{
//GUILayout.BeginHorizontal();
bool retVal = false;
var tex = Resources.Load(pathStartingFromResourcesFolder) as Texture2D;
if (tex != null)
retVal = GUILayout.Button(tex, GUILayout.Width(64), GUILayout.Height(64));
else
{
retVal = GUILayout.Button(“Select”, GUILayout.Width(64f), GUILayout.Height(64f));
}
GUILayout.Label(obj.name, GUILayout.Width(160f));
GUI.color = Color.white;
//GUILayout.EndHorizontal();
return retVal;
}
So how do I go about creating that grid layout with the buttons?
Thanks in advance for any help ![]()
