To make any class a singleton, simply inherit from the Singleton base class instead of MonoBehaviour, like so:
public class MySingleton : Singleton<MySingleton>
{
// (Optional) Prevent non-singleton constructor use.
protected MySingleton() { }
// Then add whatever code to the class you need as you normally would.
public string MyTestString = "Hello world!";
}Now you can access all public fields, properties and methods from the class anywhere using .Instance:
public class MyClass : MonoBehaviour
{
private void OnEnable()
{
Debug.Log(MySingleton.Instance.MyTestString);
}
}