public static TP GetInheritedSingleton <TP>(bool createNewInstance = true) { if (createNewInstance && (MonoSingleton <T> .MInstance == null || !((object)MonoSingleton <T> .MInstance is TP))) { MonoSingleton <T> .FindOrCreateSingleton <TP>(); } else if (!createNewInstance && (MonoSingleton <T> .MInstance == null || !((object)MonoSingleton <T> .MInstance is TP))) { MonoSingleton <T> .FindSingleton <TP>(); } if (MonoSingleton <T> .MInstance == null || !((object)MonoSingleton <T> .MInstance is TP)) { return(default(TP)); } MonoSingleton <T> .IsSingletonInitialized = true; return((TP)(object)MonoSingleton <T> .MInstance); }
public static void CreateSingleton <TP>() { MonoSingleton <T> .FindOrCreateSingleton <TP>(); }