Skip to content

Commit 3156232

Browse files
authored
Merge pull request #44 from De-Panther/webxrmanager_singleton
WebXRManager Singleton
2 parents cd33ba1 + fa32aaf commit 3156232

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Assets/WebXR/Scripts/WebXRManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ public static WebXRManager Instance
9494
private void Awake()
9595
{
9696
Debug.Log("Active Graphics Tier: " + Graphics.activeTier);
97-
instance = this;
97+
if (null == instance) {
98+
instance = this;
99+
} else if (instance != this) {
100+
Destroy(gameObject);
101+
}
102+
98103
if (instance.dontDestroyOnLoad)
99104
{
100105
DontDestroyOnLoad(instance);

0 commit comments

Comments
 (0)