Skip to content

CS0234: 'Ports' does not exist in the namespace 'System.IO'

You see this in the Console:

error CS0234: The type or namespace name 'Ports' does not exist in the namespace 'System.IO'

Or Tools > Serial Input Bridge shows only one item: Fix API Compatibility Level.

Serial ports (System.IO.Ports) only exist under the .NET Framework API level. Unity 6 and Unity 2021.3 both default to .NET Standard, which doesn’t include them.

Click Tools > Serial Input Bridge > Fix API Compatibility Level. Unity switches the project to .NET Framework, recompiles, and the full menu appears.

Or set it yourself: Edit > Project Settings > Player > Other Settings > Api Compatibility Level = .NET Framework.

If Unity opens in Safe Mode after the change, let it finish, check the API level is still .NET Framework, and restart the Editor.