Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/track/fredericrp-singleton.git README
Generic Singleton
Generic version of singleton for both MonoBehaviour and Standard classes.
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. There are two singleton:
- Singleton
that inherits from MonoBehaviour - SimpleSingleton
that does not
Usage
Extends the Singleton<T> (for MonoBehaviour singletons) or SimpleSingleton<T> (for standard classes singletons) class from your own classes like this:
public class MyBrandNewClass : Singleton<MyBrandNewClass> {
// ... fields, methods, etc.
}
You can call it from other scripts like this :
MyBrandNewClass.Instance.PublicMethod()
See Transition class for a demo.
Installs Over Time
Operating Systems
No data yet
Top Countries
No data yet
Git Versions
No data yet
Embed Install Badge
Add an install count badge to your README
[](https://www.pkglnk.dev/pkg/fredericrp-singleton)<a href="https://www.pkglnk.dev/pkg/fredericrp-singleton"><img src="https://www.pkglnk.dev/badge/fredericrp-singleton.svg?style=pkglnk" alt="pkglnk installs"></a>
No comments yet. Be the first!