When nesting Vertical and Horizontal Groups, I discovered an issue with a Button with ExpandHeight(true) inside a Horizontal Group nested inside another Vertical Group with ExpandHeight(false) causing the Vertical Groups ExpandHeight(false) to be negated. Screenshots of with and without BepInEx.OptimizeIMGUI and condensed sample code below.
public class NewBehaviourScript : MonoBehaviour
{
private Rect uiWindow2 = new Rect(UnityEngine.Screen.width / 2 + 20, 20, 120, 400);
private void OnGUI()
{
uiWindow2 = GUILayout.Window(34566, uiWindow2, DisplayUIWindowX, "TEST");
}
private void DisplayUIWindowX(int windowId)
{
GUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
{
//Header
GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
//Toolbar
{
GUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
{
//Header
GUILayout.Label("TEST", GUILayout.ExpandWidth(true));
//Options
if (GUILayout.Button("O", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
{
}
}
GUILayout.EndHorizontal();
//Options
}
}
GUILayout.EndVertical();
//Content
GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
{
//Abstract
//this.DisplayUIWindowBase();
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
//Info
GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
GUILayout.BeginHorizontal();
{
GUILayout.Label("Info: " + "", GUILayout.ExpandWidth(true));
if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true)))
{
//info = "";
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUI.DragWindow();
}
}
When nesting Vertical and Horizontal Groups, I discovered an issue with a Button with
ExpandHeight(true)inside a Horizontal Group nested inside another Vertical Group withExpandHeight(false)causing the Vertical GroupsExpandHeight(false)to be negated. Screenshots of with and without BepInEx.OptimizeIMGUI and condensed sample code below.Without BepInEx.OptimizeIMGUI (Correct):

With BepInEx.OptimizeIMGUI (Incorrect):

Condensed Sample code: