如何通过蓝牙从 Unity gear VR 应用程序发送数据?

How do I send data from Unity gear VR app over bluetooth?

我是 Unity 和 android 应用程序开发的新手。我最近拿到了三星 gear VR 和 galaxy S6。

我可以使用 Gear VR 制作简单的场景并 运行 它们。然而,对于我的项目,当我 运行 在我的 gear VR 上安装应用程序时,我想通过手机蓝牙发送有关玩家坐标、操纵杆等的数据,以便它可以在我的计算机上的 Matlab 中读取实时。

我需要这些数据来使用 Matlab 触发外部设备。

如有任何帮助,我们将不胜感激。

谢谢

你需要两边都有蓝牙插件,因为 Unity 不支持开箱即用。您可以用 Android Bluetooth API or use this cheap one 为自己写一个,只需 10 美元。

在电脑side/Windows上,可以使用Winsock RFCOMM。您可以在 Windows.

上获取示例代码 here. Other important links. Bluetooth tutorials