guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Bakery window jittery when windows text scaling is set to 125% #112

Closed farfelu closed 2 years ago

farfelu commented 2 years ago

Bakery version: 1.9
Unity version: 2018.4.20f1

I have my windows text scale setting set to 125%, which causes the Bakery window to jitter all the time. It does not impact functionality, but can get a bit annoying.

The Windows setting:
image

The Bakery window:
Video

It's fine on 100% or 150%.

guycalledfrank commented 2 years ago

Funny. Does it happen with any other Unity windows? Seems like Unity UI bug. I also can't reproduce it on my Win7 (yeah...), seems to scale correctly without flickering. Possibly some Win10 UI bug, assuming the drop-down shadow is OS-rendered.

farfelu commented 2 years ago

It's hard to see on the gif, but the entire window width seems to jump around, not just the shadow.

I've only seen it happen with Bakery (it's the only window that doesn't let me resize it) and only when the scaling is at 125%.
150%, 175%, 200% works fine (I did not test 225%, not enough screen space for that)

I've tested a bit more now and it doesn't happen in Unity 2019 to 2021, so only Unity 2018 seems to have that problem, which is as far as I know DPI aware since 2018.2.
So it seems to be a Unity bug.

I'm not very familiar with Unity Editor scripting, but found it interesting enough to play around with it a bit.
The window jitters only when the window width is set below 252 (on 125% scaling).
The default window width seems to be 250, which I'm not sure where that comes from, I couldn't find a reference to that.
Setting the windows minSize.x manually to 252 at the start of OnGUI() seems to fix it, I've tried it like this.

--- a/Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs
+++ b/Assets/Editor/x64/Bakery/scripts/ftRenderLightmap.cs
@@ -1316,6 +1316,13 @@ public class ftRenderLightmap : EditorWindow//ScriptableWizard
             return;
         }

+#if UNITY_2018_2_OR_NEWER && !UNITY_2019_1_OR_NEWER
+        if (EditorGUIUtility.pixelsPerPoint == 1.25f)
+        {
+            this.minSize = new Vector2(252, this.minSize.y);
+        }
+#endif
+
         if (tryFixingSceneView)
         {
             FindGlobalStorage();

Not really a big issue though, especially now that Unity 2018 is already end of life. We're migrating to 2019 within the next months as well.

guycalledfrank commented 2 years ago

OK, hopefully it works! https://github.com/guycalledfrank/bakery-csharp/commit/9c505240cd87353442ef84d11ac6ad6a61ac103a