public void Stop(bool destroy = true) { if (_thread != null) { _threadStop = true; _thread.Join(); _thread = null; _threadStop = false; } if (useDLL) { udp_close(); } else { if (udpClient != null) { udpClient.Close(); udpClient = null; } } if (destroy) { if (instance != null) { instance = null; Destroy(gameObject); } } }
void Awake() { instance = this; }