void Awake() { #if USE_THREAD mainThread = Thread.CurrentThread; #endif _instance = this; }
//[RuntimeInitializeOnLoadMethod] public static UnityThreadService Init() { if (_instance == null) { var go = new GameObject("_UnityThreadService"); DontDestroyOnLoad(go); _instance = go.AddComponent <UnityThreadService>(); } return(_instance); }
void OnDestroy() { _instance = null; alive = false; }