public void OnConnectClicked() { string host = m_hostInput.text; short port = short.Parse(m_portInput.text); bool ok = MyNetwork.Connect(host, port); if (!ok) { MessageBox.Show(string.Format("connect to {0}:{1} fail", host, port)); } else { PlayerPrefs.SetString(MyNetwork.HOST, host); PlayerPrefs.SetInt(MyNetwork.PORT, port); MessageBox.Show(string.Format("connect to {0}:{1} success", host, port)); } }