IEnumerator Main() { StreamReader reader = new StreamReader(stream); while (true) { if (stream.DataAvailable) { string s = reader.ReadLine(); Debug.Log(s); ReceiveEvent.Invoke(s); } yield return(null); } }