private void OnDisable()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
        public static void InitUnityThread(bool visible = false)
        {
            if (instance != null)
            {
                return;
            }
            if (Application.isPlaying)
            {
                var obj = new GameObject("MainThreadExecuter");
                if (!visible)
                {
                    obj.hideFlags = HideFlags.HideAndDontSave;
                }

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