public void OnClick() { string PlayerName = transform.GetChild(0).GetComponent <InputField>().text; string HostIPAddress = transform.GetChild(1).GetComponent <InputField>().text; netWorkManager.Connect(HostIPAddress); netWorkManager.Request(NetWorkManager.RequestParameter.PlayerName, PlayerName); this.transform.parent.gameObject.SetActive(false); }