I very recently downloaded the stable release for Unity (2018.3.5f1). I have a project that talks to a microcontroller over the serial port, and in the past have used System.IO.Ports with no issue. However, just trying to import the namespace System.IO.Ports gives me this error in the editor and I am unable to compile:
error CS0234: The type or namespace name ‘Ports’ does not exist in the namespace ‘System.IO’ (are you missing an assembly reference?)
As you can see below, my configuration settings are to use .NET 4.x and compatibility level is set to 2.0 (NOT subset, which isn’t even available in the list):
If I set the “Scripting Runtime Version” to “.NET 3.5 Equivalent”, the problem goes away. The only problem is that 3.5 is deprecated, and I would like to use something a little more future proof. Am I doing something wrong here? Do I need to check my .NET 4.x installation to see if it is missing some libraries? According to MSDN documentation, System.IO.Ports should be available in .NET 4.x. This problem persists across multiple machines & Unity installations of 2018.3.x. Any help greatly appreciated!!