From 4adf8c9ce7d1851b7d353f1754d511d65cafb842 Mon Sep 17 00:00:00 2001 From: Twirlbug Date: Tue, 27 Jun 2023 00:31:24 -0500 Subject: [PATCH] Fixed the UI not showing on smaller resolutions. Also fixed UI not moving over immediately after screen size change --- SRMP/MultiplayerUI.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/SRMP/MultiplayerUI.cs b/SRMP/MultiplayerUI.cs index b48b521..499d69c 100644 --- a/SRMP/MultiplayerUI.cs +++ b/SRMP/MultiplayerUI.cs @@ -8,7 +8,8 @@ using SRMultiplayer.Networking; public class MultiplayerUI : SRSingleton { - private Rect windowRect = new Rect(Screen.width - 300, 20, 300, 500); + private int LastWidth = 0; + private Rect windowRect = new Rect(Screen.width - 300 - 20, 20, 300, 500); private Vector2 playersScroll = Vector2.zero; private string ipaddress = "localhost"; private string port = "16500"; @@ -73,7 +74,14 @@ public class MultiplayerUI : SRSingleton if (SceneManager.GetActiveScene().buildIndex >= 2) { - windowRect = GUI.Window(1, windowRect, MultiplayerWindow, "SRMP v" + Globals.Version); + //check to see if the windows needs to move + if(LastWidth != Screen.width) + { + //recalc the window rect to move the gui + windowRect = new Rect(Screen.width - 300 - 20, 20, 300, 500); + } + + windowRect = GUILayout.Window(1, windowRect, MultiplayerWindow, "SRMP v" + Globals.Version); } }