public void NetworkConnect() { string textBoxText = textBox.GetComponent <TextMesh>().text; textBoxText = textBoxText.Substring(0, (textBoxText.Length - 20)); if (submit) { netStarter.setNetAddress(textBoxText); textBox.GetComponent <TextMesh>().text = "<color=red>_</color>"; } else { netStarter.setPort(textBoxText); netStarter.connectToHost(); textBox.GetComponent <TextMesh>().text = "<color=red>_</color>"; } submit = !submit; }