예제 #1
0
    public static T CreateInstance()
    {
        if (_instance == null)
        {
            _instance = new T();
            _instance.Initialize();
            SingletonManager.Add(_instance);
        }

        return(_instance);
    }
예제 #2
0
        public static T GetInstance()
        {
            if (_instance == null)
            {
                _instance = new T();
                if (!SingletonManager.Add(_instance))
                {
                    _instance = null;
                    return(null);
                }
            }

            return(_instance);
        }
예제 #3
0
        public static T GetInstance()
        {
            if (_instance == null)
            {
                _instance = SingletonManager.MonoSingletonGo.ExtAddComponent <T>();
                if (!SingletonManager.Add(_instance))
                {
                    _instance.ExtDestroy();
                    _instance = null;
                }
            }

            return(_instance);
        }
예제 #4
0
 public void Add(int batchIndex, SingletonBase singleton)
 {
     _singletons.Add(batchIndex, singleton);
 }