We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a61f77a commit e902a9fCopy full SHA for e902a9f
Assets/Scripts/MonoSingleton.cs
@@ -50,11 +50,25 @@ protected virtual void Awake ()
50
if ( instance == null )
51
{
52
instance = this as T;
53
- DontDestroyOnLoad ( gameObject );
+
54
+ if (Application.isPlaying)
55
+ {
56
+ DontDestroyOnLoad(gameObject);
57
+ }
58
59
+ // Init existing instance
60
+ Init();
61
}
62
else
63
- Destroy ( gameObject );
64
65
66
+ Destroy(gameObject);
67
68
+ else
69
70
+ DestroyImmediate(gameObject);
71
72
73
74
0 commit comments