From 39e3084ec840293f2ad461f50d51eeafe66cbebf Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Thu, 1 Oct 2020 18:48:20 +0900 Subject: [PATCH] fix: screen resolution in full screen mode is incorrect --- Packages/SoftMaskForUGUI/Scripts/SoftMask.cs | 23 +++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Packages/SoftMaskForUGUI/Scripts/SoftMask.cs b/Packages/SoftMaskForUGUI/Scripts/SoftMask.cs index 0730c14..5ff3497 100644 --- a/Packages/SoftMaskForUGUI/Scripts/SoftMask.cs +++ b/Packages/SoftMaskForUGUI/Scripts/SoftMask.cs @@ -675,13 +675,24 @@ private void UpdateMaskTexture() private static void GetDesamplingSize(DesamplingRate rate, out int w, out int h) { #if UNITY_EDITOR - var res = UnityEditor.UnityStats.screenRes.Split('x'); - w = Mathf.Max(64, int.Parse(res[0])); - h = Mathf.Max(64, int.Parse(res[1])); -#else - w = Screen.width; - h = Screen.height; + if (!Application.isPlaying) + { + var res = UnityEditor.UnityStats.screenRes.Split('x'); + w = Mathf.Max(64, int.Parse(res[0])); + h = Mathf.Max(64, int.Parse(res[1])); + } + else #endif + if (Screen.fullScreenMode == FullScreenMode.Windowed) + { + w = Screen.width; + h = Screen.height; + } + else + { + w = Screen.currentResolution.width; + h = Screen.currentResolution.height; + } if (rate == DesamplingRate.None) return;