public static SingletonSimple Instance() { if (ms_instance == null) { ms_instance = new SingletonSimple(); } return(ms_instance); }
// Use this for initialization void Start() { SingletonSimple s1 = SingletonSimple.Instance(); SingletonSimple s2 = SingletonSimple.Instance(); if (s1 == s2) { Debug.Log("Objects are the same instance"); } SingletonEx.Instance.DoSomething(); MonoSingletonEx.Instance.DoSomething(); }