• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Mondkin · Feb 08, 2016 at 08:54 PM · system.io.net-assemblies

Unity is not recognizing System.IO.Ports (I am not in .Net 2.0 subset)

Hello,

I have a project where I have this code:

 using UnityEngine; using
 System.Collections; using System.IO;
 using System.IO.Ports;
 ...

That last line is giving problems in only one of my machines that shows this error message:

 Assets/TouchMotion/Scripts/TouchMotionController.cs(5,17): error CS0234: The type or namespace name `Ports' does not exist in the namespace `System.IO'. Are you missing an assembly reference?

I've seen such message before when in Player Settings I have the Api Compatibility Level set to .NET 2.0 Subset instead of .NET 2.0. But in this case, I have already done that change and I continue seeing the message.

I'm compiling the project fine in another machine, so I know it's not a typo. Do you know what could be causing the problem?

Things I've tried:

  • Restarting Unity

  • Removing the Library, obj and ProjectSettings folders

Some final details in case they are useful:

  • I'm using Unity 5.3.2f1

  • The computer where it works is where I created the project. Then I copied it to the computer where it doesn't work.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Baste · Feb 15, 2016 at 01:36 PM 1
Share

What's your target platform? If it's web player (the default since 5.3 for some insane reason), you won't have access to a bunch of things - like IO.

You change the target platform in File->Build Settings. If your platform is missing, run the Unity Download Assistant again to grab it.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by michbil · Feb 15, 2016 at 02:19 PM

Here is solution:

http://forum.unity3d.com/threads/solved-the-type-or-namespace-name-ports-does-not-exist-in-the-namespace-system-io.366868/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ismaelnascimento01 · May 27, 2018 at 09:45 PM

Change in Api Compatibility Level* to .Net 2.0

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by samra2494 · Jun 10, 2020 at 07:58 AM

Change in Api Compatibility Level* to .Net4.x This has worked for me.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

35 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

System.IO.Ports with .Net Standard 2.0? 1 Answer

Can Unity work with a "Managed .NET assembly (NatNetML.dll) for use in .Net compatible clients"? 1 Answer

Search in a text file 1 Answer

Should i use yield everytime? 1 Answer

UnauthorizedAccessException: Access to the path is denied 5 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges