Exemple #1
0
        public static void DestroyInstance(Type type)
        {
            ISingleton singleton = null;

            if (_singletons.TryGetValue(type, out singleton))
            {
                singleton.Dispose();

                _singletons.Remove(type);

                if (type.IsSameOrSubClass(typeof(SingletonMono)))
                {
                    UnityEngine.Object.Destroy((singleton as SingletonMono).gameObject);
                }

                DebugEx.Log(ELogType.System, $"Singleton: Destroy instance, type= {type.Name}.");
            }
        }
Exemple #2
0
 public void Dispose()
 {
     _singleton.Dispose();
 }