Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BepInEx.OptimizeIMGUI Nested ExpandHeight in Vertical Group #6

Closed
JustAGuest4168 opened this issue Nov 29, 2022 · 1 comment
Closed
Labels
wontfix This will not be worked on

Comments

@JustAGuest4168
Copy link

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):
image

With BepInEx.OptimizeIMGUI (Incorrect):
image

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
Copy link
Member

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

@ManlyMarco ManlyMarco added the wontfix This will not be worked on label Mar 8, 2023
@ManlyMarco ManlyMarco closed this as not planned Won't fix, can't repro, duplicate, stale Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants