void OnDestroy() { Debug.Log("Shutting down ClientSocket."); shouldStop = true; if (phoneMirroringSocket != null) { phoneMirroringSocket.Close (); phoneMirroringSocket = null; } if (phoneEventThread != null) { phoneEventThread.Join(); } }