FormatException: Invalid format.
System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Double.cs:209)
System.Single.Parse (System.String s) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Single.cs:183)
TransformDemo.Update () (at Assets/Scripts/Day01/TransformDemo.cs:48)
求助各位大神,我的unity在運行時一直報這個錯,出問題的代碼如下:
string str = GetComponent<Serialport>().strbytes;
speed = float.Parse(str);
這個是將串口收到的字串轉為浮點數,不知道該怎么解決
uj5u.com熱心網友回復:
把字串列印出來看看轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/10885.html
標籤:Unity3D
