Skip to content

Commit 87001b3

Browse files
author
leander.simonart
committed
only clear it when destroying the instance it is referencing
1 parent 152b503 commit 87001b3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Runtime/Singleton.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ public virtual void Awake()
5151

5252
protected virtual void OnDestroy()
5353
{
54-
_instance = null;
54+
if( _instance == this )
55+
{
56+
_instance = null;
57+
}
5558
}
5659
}
5760
}

0 commit comments

Comments
 (0)