A simple Unity implementation of the Singleton software pattern.
The package is available on the openupm registry. It's recommended to install it via openupm-cli.
openupm add com.pixelwizards.singleton
Add this to your project manifest.json
"com.pixelwizards.singleton": "https://github.com/PixelWizards/com.pixelwizards.singleton.git",
This package is also available via the OpenUPM scoped registry: https://openupm.com/packages/com.pixelwizards.singleton/
- This has been tested for
>= 2018.3
Example:
public class MySingleton: Singleton { public void DoSomething() { } }
You can now reference the singleton via it's instance like so:
MySingleton.Instance.DoSomething();
- None