Home > OS >  System.IO.ports works in Unity but not in build
System.IO.ports works in Unity but not in build

Time:05-04

I threw together a little application in Unity which needs to access a serial port. Since Unity does not include System.IO.Ports I installed the NugetPackage with BuildSettings enter image description here

NotSupportedException: System.IO.Ports.SerialPort::.ctor
at System.IO.Ports.SerialPort..ctor (System.String portName, System.Int32 baudRate, System.IO.Ports.Parity parity, System.Int32 dataBits, System.IO.Ports.StopBits stopBits) [0x00000] in <00000000000000000000000000000000>:0 
at GetInput.Start () [0x00000] in <00000000000000000000000000000000>:0 

CodePudding user response:

I got it to work by changing the "Scripting Backend" to "Mono" and building the solution in Visual Studio.

  • Related