A singleton base class that can be used with abstract classes.
The difference with UxrSingleton<T> is that UxrSingleton<T> guarantees that an instance will always be available in the scene by instantiating the component if it’s not found. This means Instance will always be non-null and can be used with or without an instance available in the scene. UxrSingleton<T> also allows to use automatic prefab instantiation if a compatible singleton prefab is present in a special Resources folder. Since abstract classes can’t be instantiated, Instance in UxrAbstractSingleton<T> will be non-null only if a child component is available somewhere in the scene.
For design purposes, a singleton may still be desirable when programming an abstract class, hence this UxrAbstractSingleton<T> component base class.
|UxrAsyncInitAbstractSingleton<T>||Same as UxrAsyncInitSingleton<T> but allows asynchronous initialization. This can be useful where singletons require initialization through config files that are loaded asynchronously from disk or through network.|
|UxrAsyncInitSingleton<T>||Same as UxrSingleton<T> but allows asynchronous initialization. This can be useful where singletons require initialization through config files that are loaded asynchronously from disk or through network.|
An improved singleton implementation over UxrAbstractSingleton<T> for non-abstract classes. UxrSingleton<T> guarantees that an Instance will always be available by instantiating the singleton if it wasn’t found in the scene. Additionally, it can instantiate a prefab if there is one available in a well-known location.
The steps followed by this singleton implementation to assign the instance are the: