IEnumerator SendCo() { while (true) { string msg = "hello " + index; if (tcpNetComp.State == "connected") { tcpNetComp.SendString(msg); } if (kcpNetComp.State == "connected") { kcpNetComp.SendString(msg); } if (udpNetComp.State == "connected") { udpNetComp.SendString(msg); } index++; yield return(new WaitForSeconds(sendInterval)); } }
public void Test() { kcpNetComp.SendString("hello " + index++); }