- Home /
Using the SerialPort class in Unity 3.1 Free
Hi again, I read that because 3.1 uses Net 2.0, that we can now use the SerialPort Class. However when I try to create an object of said class, even when i wrote 'using System.IO.Ports;', I got the error message.
Assets/NewBehaviourScript.cs(3,17): error CS0234: The type or namespace name Ports' does not exist in the namespace
System.IO'. Are you missing an assembly reference?
Am i missing a component or is it a pro only component? Or is it that I need to update something?
Answer by DaveA · Apr 20, 2011 at 10:02 PM
You need to go to Edit/Project Settings/Player and change the .Net setting to 2.0, not subset, and reimport the script.
That said, please let me know if you get anything working. I've seen posts from people who claim it works, but not for me and several others.
This works for me. I did this in an older project, forgot where that option was hidden, and then I just redid it in my current project. I won't pretend I understand why it might work for me and not for others but there it is. I'd be happy to post code or screenshots if you think it might help.
Thanks. Oy that's an old post! I got that working and have long since moved on.
Answer by misun1191 · Feb 08, 2015 at 09:14 PM
If you get the 'System.IO.Ports does not exist' error even with .NET 2.0 setting, check whether you previously had tried to build web player. If that's the case, ignore the error message and just build standalone. Then, the error message will disappear.I think it's kind of a bug. Because web player doesn't support the System.IO.Ports, you will get the error message if you tried to build the web player. Strangely and annoyingly, the error message remains until you build new standalone which allows .NET 2.0 setting.
Somehow It was set to webplayer (which I never used). So after I set .net 2.0 I still got the error. Thanks alot.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
What is the correct way of including a text file asset to an Android build 0 Answers
How to stop Audio not all?? 0 Answers
Shutting a function when another function calling. 1 Answer
FPS KIT VERSION 2.0 0 Answers