Skip to content

Commit

Permalink
fix: screen resolution in full screen mode is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Oct 1, 2020
1 parent e3684bb commit 39e3084
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Packages/SoftMaskForUGUI/Scripts/SoftMask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 39e3084

Please sign in to comment.