Skip to content

title: Me::DerangedSenators::CopsAndRobbers::GenericSingleton summary: Generic singleton Class. Extend this class to make singleton component. Example:


Me::DerangedSenators::CopsAndRobbers::GenericSingleton

Generic singleton Class. Extend this class to make singleton component. Example: More...

Inherits from MonoBehaviour

Public Functions

Name
void Init()
This function is called when the instance is used the first time Put all the initializations you need here, as you would do in Awake

Protected Functions

Name
virtual void Awake()
virtual abstract void InternalInit() =0
virtual abstract void InternalOnDestroy() =0

Public Properties

Name
T instance

Detailed Description

template <T >
class Me::DerangedSenators::CopsAndRobbers::GenericSingleton;

Generic singleton Class. Extend this class to make singleton component. Example:

public class Foo : GenericSingleton<Foo> . To get the instance of Foo class, use Foo.instance Override [Init()](/Documentation/Cops%20And%20Robbers/Classes/classMe_1_1DerangedSenators_1_1CopsAndRobbers_1_1GenericSingleton/#function-init) method instead of using Awake() from this class.

Public Functions Documentation

function Init

inline void Init()

This function is called when the instance is used the first time Put all the initializations you need here, as you would do in Awake

Protected Functions Documentation

function Awake

inline virtual void Awake()

function InternalInit

virtual abstract void InternalInit() =0

function InternalOnDestroy

virtual abstract void InternalOnDestroy() =0

Public Property Documentation

property instance

static T instance;

Updated on 25 January 2021 at 08:57:32 UTC