我想开发这样的应用程序,它将从我的蓝牙模块UC-05中获得串行数据。我在java中使用了代码,但我不知道如何将它整合在一起。
答案 0 :(得分:0)
这是没有人会在这里为你做的事情,但我会给你自己做的所需信息。
您需要将Java蓝牙代码转换为函数。例如,bluetoothInit()
,bluetoothConnect()
,bluetoothSend()
,bluetoothReceive()
,bluetoothDisconnect()
,bluetoothClose()
。然后将其编译为插件( jar 或 aar )文件。您现在可以从Unity C#调用这些函数。
如何在Unity中从C#调用Java函数的链接。我建议你按照第一个链接。
http://www.what-could-possibly-go-wrong.com/creating-a-native-android-plugin-for-unity3d/
http://www.thegamecontriver.com/2015/04/android-plugin-unity-android-studio.html
https://www.thepolyglotdeveloper.com/2014/06/creating-an-android-java-plugin-for-unity3d/