BomberUnits
...a Unity learning project
MonoSingleton< T > Class Template Reference

A base class for all our singletons, which are mainly management behaviours. More...

+ Inheritance diagram for MonoSingleton< T >:
+ Collaboration diagram for MonoSingleton< T >:

Static Public Member Functions

static T Get ()
 Singleton access.
 

Protected Member Functions

virtual void MyAwake ()
 You may override this to have an Awake()-like function. More...
 

Static Protected Attributes

static T instance
 Singleton pattern instance.
 

Private Member Functions

void Awake ()
 

Detailed Description

A base class for all our singletons, which are mainly management behaviours.

It is set to be not destroyed on load and provides the usual static Get() and duplicate destruction. The subclass has to give its own type for the singleton to handle. You have to use MyAwake() instead of Awake() from MonoBehaviour.

Type Constraints
T :MonoBehaviour 

Definition at line 9 of file MonoSingleton.cs.

Member Function Documentation

◆ MyAwake()

virtual void MyAwake ( )
inlineprotectedvirtual

You may override this to have an Awake()-like function.

Only called if this is the first instance as all further instances are destroyed.

Reimplemented in LevelManager, PlayerManager, and GameSettings.

Definition at line 30 of file MonoSingleton.cs.


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