unity与Arduino通信,ReadLine()读取卡顿问题

update()
{
if (stream != null && stream.IsOpen)
{
string value = stream.ReadLine();

        Debug.Log(value);

        //相当奇特的解决办法,清掉缓冲区
        int nCount = stream.BytesToRead;
        if (nCount != 0)
        {
            byte[] btAryBuffer = new byte[nCount];
            stream.Read(btAryBuffer, 0, nCount);
        }

    }

}
我用readline读取光敏传感器的数据,在unity中运行卡顿问题非常严重,大家有什么解决方法吗