public static void FindOrCreateSingleton <TP>()
    {
        if (MonoSingleton <T> .MInstance == null)
        {
            MonoSingleton <T> .FindSingleton <TP>();

            if (MonoSingleton <T> .MInstance == null)
            {
                MonoSingleton <T> .MInstance = (new GameObject(string.Concat("Temp Instance of ", typeof(TP)), new Type[] { typeof(TP) })).GetComponent <T>();
            }
            MonoSingleton <T> .MInstance.Initialize();

            MonoSingleton <T> .IsSingletonInitialized = true;
        }
    }
 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);
 }