1
votes

I tried to communicate with a serial port using System.IO.Ports using Unity Editor and it worked. But I need to deploy it to HoloLens, which need a UWP application as build. (https://answers.unity.com/questions/1467623/type-or-namespace-not-found-in-namespace-systemio.html) <-- My question

So when I want to build my project, I get errors because Namespace 'Ports' is not defined.

I Googled and found that in UWP System.IO.Ports is not supported. But there is another class for such use cases. Windows.Devices.SerialCommunication

But the problem is, that Unity can't find these Namespace and it seems that it doesn't support the 'Windows' namespace all over.

How can I use a class for Unity3D, Hololens (UWP) to communicate with a serial port?

1

1 Answers

0
votes

Yep. The system port api is not supported in winrt. So you need to use winrt api instead.

To use winrt API. The details has been wrote here: Using the Windows namespace with Unity apps for HoloLens and also here: Universal Windows Platform: WinRT API in C# scripts