Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#SerialPort.ReadExisting错误_C#_Unity3d - Fatal编程技术网

C#SerialPort.ReadExisting错误

C#SerialPort.ReadExisting错误,c#,unity3d,C#,Unity3d,我已经通过com端口将一个Unity项目连接到Arduino板上。使用SerialPort.ReadLine()时,我可以从它接收数据,但是,如果使用SerialPort.ReadExisting()我会得到错误: 对象引用未设置为对象的实例 我需要使用ReadExisting,因为我的应用程序无法跟上Ardunio板吐出数据的速度 我在XNA项目中工作得很好,但在unity项目中使用时,我遇到了一些问题 任何帮助都将不胜感激。我将使用该活动。然后在事件处理程序中,尝试调用ReadExistin

我已经通过com端口将一个Unity项目连接到Arduino板上。使用
SerialPort.ReadLine()
时,我可以从它接收数据,但是,如果使用
SerialPort.ReadExisting()
我会得到错误:

对象引用未设置为对象的实例

我需要使用ReadExisting,因为我的应用程序无法跟上Ardunio板吐出数据的速度

我在XNA项目中工作得很好,但在unity项目中使用时,我遇到了一些问题


任何帮助都将不胜感激。

我将使用该活动。然后在事件处理程序中,尝试调用ReadExisting。我发布的链接有一个例子。

Unity不允许您使用DataReceived事件