Skip to content

Commit

Permalink
bug fix for unity single persistant when using on editor scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Reddevildragg committed May 7, 2021
1 parent 7f58c68 commit 1f51b65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Assets/Singletons/UnitySingletonPersistent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void ValidateInstance(bool createIfNeeded = false)
_instance = obj.AddComponent<T>();
}

if (_instance != null)
if (_instance != null && Application.isPlaying)
{
Helpers.RegisterDontDestroy(_instance.gameObject);
DontDestroyOnLoad(_instance);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Singletons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.greener-games.singletons",
"displayName": "Unity singleton",
"description": "Collection of Singleton for use in unity",
"version": "1.0.3",
"version": "1.0.4",
"unity": "2018.1",
"license": "MIT",
"author": {
Expand Down

0 comments on commit 1f51b65

Please sign in to comment.