Skip to content

Commit

Permalink
fix: avoid creating many Mask Screen objects
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Aug 3, 2024
1 parent 432e4a1 commit 785b2c2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ private void OnDestroy()

public void Init(RawImage screen, int width, int height)
{
if (_screenObject != null)
{
Destroy(_screenObject);
}
// copy the target screen to overlay mask.
_screenObject = new GameObject("Mask Screen");
_screenObject.transform.SetParent(screen.transform, false);
Expand Down

0 comments on commit 785b2c2

Please sign in to comment.