using UnityEngine; using System.Collections; using System.IO.Ports; using System; public class RS232 : MonoBehaviour { SerialPort sp = new SerialPort("COM2", 9600); // Use this for initialization void Start () { // sp = new SerialPort("COM10", 9600); sp.ReadTimeout=100; sp.Open(); } // Update is called once per frame void Update () { try{ print (sp.ReadLine()); }catch(Exception e){}; } }