示例#1
0
 public static void Initialize()
 {
     if (!initialized)
     {
         if (!Application.isPlaying)
         {
             return;
         }
         instance    = new GameObject("ThreadResolver").AddComponent <MainThreadResolver>();
         initialized = true;
         DontDestroyOnLoad(instance.gameObject);
     }
 }
示例#2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance    = this;
         initialized = true;
         DontDestroyOnLoad(gameObject);
     }
     else
     if (instance != this)
     {
         Destroy(this);
     }
 }