Ejemplo n.º 1
0
 public void OnDisable()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
Ejemplo n.º 2
0
        public static void InitUnityThread(bool visible = false)
        {
            if (_instance != null)
            {
                return;
            }
            if (!Application.isPlaying)
            {
                return;
            }
            var obj = new GameObject("MainThreadExecuter");

            if (!visible)
            {
                obj.hideFlags = HideFlags.HideAndDontSave;
            }
            DontDestroyOnLoad(obj);
            _instance = obj.AddComponent <UnityThread>();
        }