It is offered as open source. You can use it as you wish. Contact me when you need help.
- Create a class that you want to make singleton.
public class SampleSingletonObject : MonoBehaviour
{
}
- Derive this class from the MonoSingleton class.
public class SampleSingletonObject : MonoSingleton<SampleSingletonObject>
{
public void SampleMethod()
{
}
}
- Now you can access your singleton class.
public class SampleClass : MonoBehaviour
{
public void Start()
{
SampleSingletonObject.Instance.SampleMethod();
}
}
- Create a class that you want to make singleton.
public class SampleSingletonObject
{
}
- Derive this class from the Singleton class.
public class SampleSingletonObject : Singleton<SampleSingletonObject>
{
public void SampleMethod()
{
}
}
- Now you can access your singleton class.
public class SampleClass : MonoBehaviour // You don't have to inherit MonoBehaviour.
{
public void Start()
{
SampleSingletonObject.Instance.SampleMethod();
}
}
- You're done!
Happy Code Bending!