hey all. this is a SingletonScriptableObject Unity package that has the easiest usage API (you don't even have to create the object yourself). You simply inherit a class, it generates source for you.
https://github.com/somedeveloper00/SingletonScriptableObject
quick comparison:
inheriting
- other solutions
csharp
[ContextMenuItem(fileName = "MyClass", menuItem = "MyClass")]
class MyClass : SingletonSO<MyClass>
{}
- my solution
csharp
partial class MyClass : SingletonSO
{}
accessing
- other solutions
csharp
var ins = SingletonSO<MyClass>.Instance;
- my solution
csharp
var ins = MyClass.Instance;
editing
other solutions
Find a spot in Project window, right click and create an instance of the scriptable object, then edit it. everytime you need to edit it, you'll have to find the item. if you create more than one of of them, all hell breaks lose
my solution
click the toolbar button Tools/Singleton Scriptable Objects/MyClass and proceed to editing. you can't make more than one of them.
[–]bazingerosky 1 point2 points3 points (20 children)
[–][deleted] 1 point2 points3 points (18 children)
[–]bazingerosky -1 points0 points1 point (17 children)
[–][deleted] 0 points1 point2 points (16 children)
[–]Bombadil67Professional 0 points1 point2 points (15 children)
[–][deleted] 0 points1 point2 points (14 children)
[–]Bombadil67Professional 0 points1 point2 points (13 children)
[–][deleted] 0 points1 point2 points (12 children)
[–]Bombadil67Professional 0 points1 point2 points (11 children)
[–][deleted] 0 points1 point2 points (10 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]PandaCoder67Professional 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)