Пример #1
0
 public void OnDisable()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Пример #2
0
        public static void Init()
        {
            if (instance != null)
            {
                return;
            }

            GameObject obj = new GameObject("UnityMainThread");

            DontDestroyOnLoad(obj);
            instance = obj.AddComponent <UnityMainThread>();
        }