![]() |
Infohazard.Core 1.4.1
Infohazard Core Utility Library
|
Base class that makes it easier to write scripts that always have exactly one instance. More...
Properties | |
static T | Instance [get] |
Get the singleton instance of the script. More... | |
Base class that makes it easier to write scripts that always have exactly one instance.
You can inherit from this script in managers or other scripts. You must still place the script on a GameObject in the scene. A static Instance accessor is automatically provided, which will do a lazy search for the correct instance the first time it is used, or if the previous instance was destroyed. After that it will just return a cached instance.
T | Pass the name of the inheriting class here to set the type of Instance. |
T | : | SingletonBase |
|
staticget |
Get the singleton instance of the script.
If it hasn't been found yet (or the old instance was destroyed), will do a search using Object.Find{T}
. Otherwise it returns the cached instance. However, it will not create a new instance for you.