Skip to content

Latest commit

 

History

History

Singleton

Singleton

A singleton is a development pattern that prevents having multiple instances of the same component in a scene. It allows also any script to access this one wihout requiring a manual link between the two.

This one is a generic Singleton that allows you to inherit from it from your class to access its instance with the static Instance property.

Usage

Extends the Singleton class from your own classes like this :

public class MyBrandNewClass : Singleton<MyBrandNewClass> {
// ...
}

You can call it from other scripts like this :

MyBrandNewClass.Instance.PublicMethod()

See Transition class for a demo.