FAQ
Scriptable Singleton
How is this different from using a regular Singleton (monobehavior) ?
It's not different from a code access standpoint (both accessed via Instance without needing a reference). However, using a ScriptableObject for a Singleton gives us these benefits:
Does not require to be in a scene
Does not Reset values exiting Playmode (you can make it a ResettableScriptableObject if you want though)
Therefore, if you are going to use the Singleton Pattern in your project, you might as well make it a ScriptableObject !
One of Soap's strength is to prevent the Singleton usage in a project. Why including it in the core package?
Because rules are meant to be broken and I have been guilty of using it and appreciating the speed and usefulness of such pattern at times. I expected 90% of Soap user to not use it, but for 10% and especially developers that are under very strict deadlines and have to iterate often it can be useful.
Last updated