public void OnDisable() { if (instance == this) { instance = null; } }
public static void Init() { if (instance != null) { return; } GameObject obj = new GameObject("UnityMainThread"); DontDestroyOnLoad(obj); instance = obj.AddComponent <UnityMainThread>(); }