BepInEx.OptimizeIMGUI Nested ExpandHeight in Vertical Group
JustAGuest4168 opened this issue · 1 comments
JustAGuest4168 commented
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.
Without BepInEx.OptimizeIMGUI (Correct):
With BepInEx.OptimizeIMGUI (Incorrect):
Condensed Sample code:
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();
}
}
ManlyMarco commented
It looks like it's not an easy thing to fix without straight up disabling the feature, so unfortunately I'll have to mark this as a nofix. If anyone is able to fix this I'll be happy to merge a PR.
For now I added a warning to the readme ba276fe