예제 #1
0
        public static SingletonSimple Instance()
        {
            if (ms_instance == null)
            {
                ms_instance = new SingletonSimple();
            }

            return(ms_instance);
        }
예제 #2
0
        // 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();
        }