使用Unity进行简单的iOS蓝牙数据传输 [英] Simple iOS Bluetooth Data Transmission Using Unity
问题描述
是否有任何简单(甚至不那么简单)的方式在使用Unity的2个iOS设备之间传输少量数据(一些小字符串和偶尔的数字)?我知道资产商店有一些资产,但这些资产是向上或50美元并且远远超过了。或者有一个很好的教程,我可以遵循?
Is there any simple (or even not so simple) way to transmit just small amounts of data (some small strings and the occasional number) between 2 iOS devices using Unity? I know there are some assets on the Asset Store, but those are upwards or $50 and far overkill. Or is there a good tutorial for this that I can follow?
推荐答案
那些是向上或50美元
those are upwards or $50
不,他们不是。这是 Android 的蓝牙插件和 iOS 只需10美元。
No, they are not. Here is a Bluetooth plugin for Android and iOS for $10.
规则如下:
如果你是一个人,用那个。你会节省自己的时间。如果你在公司工作,你应该制作自己的插件。
If you are one person, use that. You will save yourself time. If you are working for a company, you should make your own plugin.
是否有一个很好的教程,我可以遵循?
is there a good tutorial for this that I can follow?
如果您决定制作自己的蓝牙插件,则必须先学习Java。制作一个简单的Android Java蓝牙程序,并在您的Android设备上进行测试。如果它可以工作,那么你可以通过将代码分成诸如 bluetoothInit()
, bluetoothConnect()等函数将它简单地转换为插件。 code>,
bluetoothSend()
, bluetoothReceive()
, bluetoothDisconnect()
, bluetoothClose()
。然后将其编译为插件( jar 或 aar )文件。您现在可以从Unity C#调用这些函数。
If you decide to make your own Bluetooth plugin, you must first learn Java. Make a simple Android Java Bluetooth program and test it on your Android device. If it works, then you can then simply convert it into a plugin by seperating the code into functions such as bluetoothInit()
, bluetoothConnect()
, bluetoothSend()
, bluetoothReceive()
, bluetoothDisconnect()
, bluetoothClose()
. Then compile it into a plugin (jar or aar) file. You can now call the functions from Unity C#.
了解 Android蓝牙API 。
如何在Unity中从C#调用Java函数的链接。我建议你按照第一个链接。
Links on how to call Java functions from C# in Unity. I suggest you follow the first link.
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
< a href =https://www.thepolyglotdeveloper.com/2014/06/creating-an-android-java-plugin-for-unity3d/ =nofollow> https://www.thepolyglotdeveloper.com/2014 / 06 / creating-an-android-java-plugin-for-unity3d /
编辑:
对于 iOS ,您需要学习Objective-C。学习iOS蓝牙API,然后制作一个插件。
For iOS, you need to learn Objective-C. Learn iOS Bluetooth API then make a plugin.
http://code.tutsplus。 com / tutorials / ios-7-sdk-core-bluetooth-practical-lesson-mobile-20741
这篇关于使用Unity进行简单的iOS蓝牙数据传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!