Skip to content

Commit 44b78eb

Browse files
committed
Check activeSelf before setting SetActive
1 parent b671034 commit 44b78eb

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Assets/MRTK/Services/DiagnosticsSystem/MixedRealityToolkitVisualProfiler.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,15 @@ private void LateUpdate()
449449
}
450450

451451
// Update visibility state.
452-
window.gameObject.SetActive(ShouldShowProfiler);
453-
memoryStats.gameObject.SetActive(memoryStatsVisible);
452+
if (window.gameObject.activeSelf != ShouldShowProfiler)
453+
{
454+
window.gameObject.SetActive(ShouldShowProfiler);
455+
}
456+
457+
if (memoryStats.gameObject.activeSelf != memoryStatsVisible)
458+
{
459+
memoryStats.gameObject.SetActive(memoryStatsVisible);
460+
}
454461
}
455462
}
456463

@@ -648,8 +655,15 @@ private void BuildWindow()
648655
}
649656
}
650657

651-
window.gameObject.SetActive(ShouldShowProfiler);
652-
memoryStats.gameObject.SetActive(memoryStatsVisible);
658+
if (window.gameObject.activeSelf != ShouldShowProfiler)
659+
{
660+
window.gameObject.SetActive(ShouldShowProfiler);
661+
}
662+
663+
if (memoryStats.gameObject.activeSelf != memoryStatsVisible)
664+
{
665+
memoryStats.gameObject.SetActive(memoryStatsVisible);
666+
}
653667
}
654668

655669
private void BuildFrameRateStrings()

0 commit comments

Comments
 (0)