diff --git a/Runtime/Scripts/Controls/ImWindow.cs b/Runtime/Scripts/Controls/ImWindow.cs index aaf2cc6..740720f 100644 --- a/Runtime/Scripts/Controls/ImWindow.cs +++ b/Runtime/Scripts/Controls/ImWindow.cs @@ -29,16 +29,16 @@ public static bool BeginWindow(this ImGui gui, string title, ref bool open, ImSi { var rect = GetInitialWindowRect(gui, size); - return BeginWindow(gui, title, ref open, rect, flags); + return BeginWindow(gui, title, ref open, ref rect, flags); } - public static void BeginWindow(this ImGui gui, string title, ImRect rect, ImWindowFlag flags = ImWindowFlag.None) + public static void BeginWindow(this ImGui gui, string title, ref ImRect rect, ImWindowFlag flags = ImWindowFlag.None) { var open = true; - BeginWindow(gui, title, ref open, rect, flags | ImWindowFlag.NoCloseButton); + BeginWindow(gui, title, ref open, ref rect, flags | ImWindowFlag.NoCloseButton); } - public static bool BeginWindow(this ImGui gui, string title, ref bool open, ImRect rect, ImWindowFlag flags = ImWindowFlag.None) + public static bool BeginWindow(this ImGui gui, string title, ref bool open, ref ImRect rect, ImWindowFlag flags = ImWindowFlag.None) { if (!open) { @@ -81,6 +81,8 @@ public static bool BeginWindow(this ImGui gui, string title, ref bool open, ImRe gui.Layout.Push(ImAxis.Vertical, contentRect); gui.BeginScrollable(); + rect = state.Rect; + return true; } diff --git a/Runtime/Scripts/IO/UGUI/ImuiUnityGUIBackend.cs b/Runtime/Scripts/IO/UGUI/ImuiUnityGUIBackend.cs index 88136ad..df77f27 100644 --- a/Runtime/Scripts/IO/UGUI/ImuiUnityGUIBackend.cs +++ b/Runtime/Scripts/IO/UGUI/ImuiUnityGUIBackend.cs @@ -97,7 +97,6 @@ protected override void Awake() } } - scheduler ??= GraphicsSettings.currentRenderPipeline ? new ImuiScriptableRenderingScheduler() : new ImuiBuiltinRenderingScheduler(); useGUILayout = false; } @@ -122,6 +121,8 @@ protected override void OnEnable() { base.OnEnable(); + scheduler ??= GraphicsSettings.currentRenderPipeline ? new ImuiScriptableRenderingScheduler() : new ImuiBuiltinRenderingScheduler(); + if (ClearTexture == null) { ClearTexture = new Texture2D(1, 1, TextureFormat.RGBA32, false);