Skip to content

Commit

Permalink
fix: softmask-buffer is cleared when TMPSubMeshUI is activated via Ed…
Browse files Browse the repository at this point in the history
…itorGUI

close #180
  • Loading branch information
mob-sakai committed Aug 10, 2024
1 parent d756212 commit 13648ca
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Packages/src/Runtime/Internal/Utilities/RenderTextureRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,25 @@ public static Vector2Int GetScreenSize(int downSamplingRate)
public static Vector2Int GetScreenSize()
{
#if UNITY_EDITOR
if (!Application.isPlaying && !Camera.current)
int ParseToInt(string s, int start, int end)
{
var res = UnityStats.screenRes.Split('x');
return new Vector2Int(Mathf.Max(8, int.Parse(res[0])), Mathf.Max(8, int.Parse(res[1])));
var result = 0;
for (var i = start; i < end; i++)
{
result = result * 10 + (s[i] - '0');
}

return result;
}

Profiler.BeginSample("(COF)[RTRepository] GetScreenSize (Editor)");
var screenRes = UnityStats.screenRes;
var separator = screenRes.IndexOf('x');
var w = Mathf.Max(8, ParseToInt(screenRes, 0, separator));
var h = Mathf.Max(8, ParseToInt(screenRes, separator + 1, screenRes.Length));
Profiler.EndSample();

return new Vector2Int(w, h);
#endif
return new Vector2Int(Screen.width, Screen.height);
}
Expand Down

0 comments on commit 13648ca

Please sign in to comment.