0

I do not know the problem here. I am using a bluetooth device for connection to Unity. I have used visual studio to code. My problem is that my code works fine on Visual Studio. But when I run the same program on Unity, it starts giving me this error:

Rethrow as PlatformNotSupportedException: 32feet.NET does not support the Bluetooth stack on this device. InTheHand.Net.Bluetooth.Msft.SocketBluetoothClient..ctor (InTheHand.Net.Bluetooth.Factory.BluetoothFactory fcty) (at :0)

Does anyone know how to resolve this issue ? It would be a lot of help.

Thanks

Magneto
  • 17
  • 5
  • It looks like a mono bug. Exception throws in the SocketBluetoothClient() constructor that calls to CreateSocket() function. And if CreateSocket() throws an exception it re-raised as provided one. CreateSocket function just calls to return new Socket(BluetoothAddressFamily, SocketType.Stream, BluetoothProtocolType.RFComm); So probably mono does not support such socket types. – Mike Petrichenko Nov 27 '18 at 08:18
  • Did you ever resolve this issue? I am having this same problem. – SteenPetersen Nov 01 '19 at 19:48

1 Answers1

0

The system.net.socket class work a little different in mono compared to the standard .net implementation. here is a post about it. https://peterfoot.net/2018/03/22/bluetooth-from-unity/

How do you connect to the device, maybe there is another aproach?

Joa
  • 44
  • 6
  • I am using a BioRadio device that connects using Bluetooth and collects EEG data. It works in Visual studio and streams data using Bluetooth. I made some stimulus to collect data from Unity but it shows 32feet.NET error. In the link it specifies that, the library supports Windows desktop .NET 4.6 and Mono .NET 2.0 for Unity. I am using .NET 4.6 as well. Does it mean that i need to use MonoDevelop for Unity in order for it to work ? I am a naive so just wanted more detail. – Magneto Nov 29 '18 at 07:21
  • Try go Mono .Net 2.0. I had a similar issue on websocket connecting to an Emotive headset. Where it first worked in VS 2017, but did not work while moving to unity. change to Mono Net 2.0 helped resolve it there. – Joa Nov 29 '18 at 08:09
  • Actually the BioRadio SDK works on .NET Framework version 4.5 or later. Will such configuration work with Mono .Net 2.0 ? Also, would you mention how to use mono within visual studio ? I mean the configuration and all. I could not find any clear information elsewhere. – Magneto Nov 29 '18 at 11:42
  • Hey @Joa, can you specify how to change to mono .net 2.0 ? Do I need to use MonoDevelop to use mono 2.0 or Can I do something using Visual Studio also ? I have not used it before and there have not been many people on the community forums who have gone through this problem. – Magneto Dec 01 '18 at 09:54
  • in unity: Edit->Player-> Scroll down to configuration in the inspector, there you should be alowed to change it. (remember take a screenshot of your settings for backup before playing with this). – Joa Dec 03 '18 at 10:26
  • You could use Visual Studio for the development – Joa Dec 03 '18 at 10:29