-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hibzzgames/disable-scriptable-asset-creator
Added option to disable Scriptable Singleton Asset Creator
- Loading branch information
Showing
5 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// This script should only run when define manager is installed | ||
#if ENABLE_DEFINE_MANAGER | ||
|
||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using Hibzz.DefineManager; | ||
|
||
namespace Hibzz.Singletons.Editor | ||
{ | ||
/// <summary> | ||
/// Used to register the defines | ||
/// </summary> | ||
internal class DefineRegistrant | ||
{ | ||
[RegisterDefine] | ||
static DefineRegistrationData RegisterDisableScriptableObjectCreator() | ||
{ | ||
DefineRegistrationData data = new DefineRegistrationData(); | ||
|
||
data.Define = "DISABLE_SCRIPTABLE_SINGLETON_CREATOR"; | ||
data.DisplayName = "Disable Scriptable Singleton Creator"; | ||
data.Category = "Hibzz.Singletons"; | ||
data.Description = "The scriptable singleton creator functionality " + | ||
"lets users mark any ScriptableSingleton class with an attribute " + | ||
"called `CreateScriptableSingletonAsset`. When the user presses " + | ||
"the \"Create Scriptable Singleton Assets\" button, the system " + | ||
"will create any missing assets for those singletons in the " + | ||
"\"Resources/Singletons\" folder. \n\n" + | ||
"Installing this define will disable this feature."; | ||
data.EnableByDefault = false; | ||
|
||
return data; | ||
} | ||
} | ||
} | ||
|
||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
Scripts/Attributes/CreateScriptableSingletonAssetAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
// as long as the scriptable singleton asset creator isn't disabled | ||
#if !DISABLE_SCRIPTABLE_SINGLETON_CREATOR | ||
|
||
namespace Hibzz.Singletons | ||
{ | ||
public class CreateScriptableSingletonAssetAttribute : Attribute { } | ||
} | ||
|
||
#endif |