使用 Unity 进行简单的 iOS 蓝牙数据传输 [英] Simple iOS Bluetooth Data Transmission Using Unity

查看:73
本文介绍了使用 Unity 进行简单的 iOS 蓝牙数据传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何简单(甚至不那么简单)的方法可以使用 Unity 在 2 个 iOS 设备之间传输少量数据(一些小字符串和偶尔的数字)?我知道 Asset Store 上有一些资产,但这些资产都在 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

不,他们不是.这是一个 蓝牙 插件,适用于 AndroidiOS 只需 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()bluetoothSend() 之类的函数来简单地将其转换为插件bluetoothReceive()bluetoothDisconnect()bluetoothClose().然后将其编译为插件(jaraar)文件.您现在可以从 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-c​​ould-possively-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/

对于iOS,你需要学习Objective-C.学习iOS蓝牙API然后做一个插件.

For iOS, you need to learn Objective-C. Learn iOS Bluetooth API then make a plugin.

https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/AboutCoreBluetooth/Introduction.html

http://code.tutsplus.com/tutorials/ios-7-sdk-core-bluetooth-practical-lesson--mobile-20741

这篇关于使用 Unity 进行简单的 iOS 蓝牙数据传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆