Go Down

Topic: Arduino to Unity - System.IO.Ports does not exist (Read 1 time) previous topic - next topic


I have a very unique case involving taking output from Arduino to Unity. What I'm trying to do is take output from Arduino, simply a 1 or 0 from button input, into Unity to do something. My arduino code is working and I know it returns 1 or 0 from my button input.

Now most sources say for Unity to take Arduino output as input I have to first access the serial port that Arduino uses. This is done by using the System.IO.Ports namespace through a script. Problem is, System.IO.Ports (specifically the .Ports namespace) does not exist in my version of Unity (5.3 free).

Some sources say switching the .NET framework from a 2.0 subset to 2.0 should resolve the issue. It does not. The namespace .Ports still does not exist in .NET 2.0. Maybe it is due to me using Unity 5.3 Free instead of Pro, as some forums mention the pro version not having this issue (although for older version of Unity - ie. 3.0). If the simplest, 100% sure-fire way of getting this to work is by purchasing Unity pro, just say so and disregard the rest of the post. If not, please suggest an alternative.

I appreciate any responses in advance, and thanks for reading my post.


Thank you so very much for the helpful advice. I never thought to go to the Unity forums for help. What a brilliant idea... /s.


I had the same problem where .Ports namespace did not exist. However for me, switching to the API Compatibility from Subset 2.0 to just 2.0 solved my problems.

For those looking to try this, in Unity:
1) go to file>build settings>player settings and scroll down in the inspector to configuration where you will see .NET 2.0 subset... change that to just 2.0

2) Save everything, close and reboot Unity (sometimes you don't need to do this).

Hope this helps!

Go Up