After importing, you can access devices connected to Virtual Serial Ports and use them to retrieve or send data. However, using the current framework in Unity will throw an error of not recognising System.IO.Ports. This is because Unity operates on the .NET 2.0 subset framework on default
In order to fix this, you need to change settings to .NET 2.0
Click on Edit in the menu toolbar. Head over to Project Settings, and select Player. On the inspector window, click on Other Settings. Scroll Down until you find the Api Compatibility Level under Configuration. Change this from subset to the .NET 2.0 framework.
Now, you need to define your serial port and give arguments in the Start() function, and access data in the Update() function. Declare your serial port outside the functions using the command 'SerialPort <name>;'
The final step involves using the Update() function to continuously read the data from the gyroscope. The code below reads the data into a String called read-data, and prints it to the console. You can split the output, or print them all line-by-line using the for-each loop.
You can now access the gyroscope's data in Unity.
Two roads diverged in a wood, and I--