void OnDisable() { if (receiveThread != null) { receiveThread.Abort(); } Debug.Log("Closing UDP"); if (udp != null) { udp.Release(); } }