WeatherBlender
v1.0
Weather and Climate Engine for Unity3D
|
Be aware this will not prevent a non singleton constructor such as T myT = new T();
To prevent that, add protected T () {}
to your singleton class.
More...
Public Member Functions | |
void | OnDestroy () |
When Unity quits, it destroys objects in a random order. More... | |
Properties | |
static T | Instance [get] |
Be aware this will not prevent a non singleton constructor such as T myT = new T();
To prevent that, add protected T () {}
to your singleton class.
As a note, this is made as MonoBehaviour because we need Coroutines.
T | : | MonoBehaviour |
void Singleton< T >.OnDestroy | ( | ) |
When Unity quits, it destroys objects in a random order.
In principle, a Singleton is only destroyed when application quits. If any script calls Instance after it have been destroyed, it will create a buggy ghost object that will stay on the Editor scene even after stopping playing the Application. Really bad! So, this was made to be sure we're not creating that buggy ghost object.
|
staticget |