WeatherBlender  v1.0
Weather and Climate Engine for Unity3D
Public Member Functions | Properties | List of all members
Singleton< T > Class Template Reference

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...

Inheritance diagram for Singleton< T >:

Public Member Functions

void OnDestroy ()
 When Unity quits, it destroys objects in a random order. More...
 

Properties

static T Instance [get]
 

Detailed Description

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.

Type Constraints
T :MonoBehaviour 

Member Function Documentation

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.

Property Documentation

T Singleton< T >.Instance
staticget

The documentation for this class was generated from the following file: