Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by LeeJBaxter · Oct 04, 2018 at 08:09 AM · pluginbluetoothcrossplatform

How do I make use of Bluetooth in Unity (to control my PC-based project from an Android Tablet)?

I'm working on a PC-based system developed in Unity that displays interactive scenarios inside of a box-shaped room using multiple projectors; basically a low-end CAVE system. One of the requirements of the project is that the scenarios can be controlled with a tablet; we previously used an iPad (the original model!) with Jumi-Controller to emulate a keyboard and mouse, but it kept bugging out and caused the movement to go out of control (I suspect it may have been caused by Wifi connection issues).


I've now bought a new Android tablet to control the system; the reason I've gone for Android is so that I can potentially develop a custom controller application for our scenarios. I want to start experimenting with this as soon as possible, but I'm opting for Bluetooth rather than Wifi for the connection. Unfortunately, I'm unsure how to get Bluetooth working in Unity. Here's what I need to know;

  • Are there any ready-made assets on the store that allows a developer to use Bluetooth in Unity for PC standalone builds (I've seen plenty for Android, but it seems as though solutions for PC are harder to find).

  • If the best solution is going to be rolling my own C++ plugin, how do I go about this? Are there any caveats I need to be aware of to get this thing running smoothly?

  • What variant of Bluetooth should I be going for; apologies that I'm not very knowledgeable in this area, but I'm guessing I should try to use Bluetooth LE (Low Energy)?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by JVene · Oct 04, 2018 at 11:16 AM

First, Bluetooth will work with the PC using the PC's configuration Bluetooth devices, registering the device as a joystick/gamepad controller, but only if the PC has a Bluetooth receiver in it. If it doesn't, most of the Android based utility apps that do this have a TCP/IP option, but there must be some TCP/IP receiver on the PC (perhaps built into the Unity app) to receive it an interpret that as gamepad information. You probably don't need to consider a C++ plugin, C# has the ability to deal with various input means (and that's a lot simpler for such a project).


The details depend entirely on the app you choose for Android as to how data gets to the Unity app. If (and that's a big if) the app can convince Windows that it is a Gamepad Bluetooth device, and the PC has a bluetooth receiver on it, Unity will see the device as an 'official' Windows interface device and see it as a gamepad, after which you proceed in Unity with the least bit of effort.


To that end there are a number of cheap GamePad Bluetooth devices (which have proliferated of late due to VR adapter headsets for phones where this is desirable), which may make this work a bit easier, if the Android attachment doesn't convince Windows it is factually a gamepad.


If all of that fails, the app you choose for Android will have to offer a TCP/IP interface option, and the rest depends on how that is handled (the app might have something for Windows to receive and 'interpret' the packets as a Gamepad device). The worst case scenario is that you'd have to open a TCP/IP connection in C# (in Unity), accept packets and interpret the data so as to feed position and control information to your app as if it were Gamepad input.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LeeJBaxter · Oct 04, 2018 at 12:11 PM 0
Share

I perhaps ought to explain things a bit better. The controller app on the Android will not merely function as a keyboard/mouse, but will be able to contain an entire UI with other elements such as sliders and text-boxes. What I'm looking for is the ability to use Bluetooth for serial communication so that I can send messages back and forth between a Unity app on the Android tablet and another Unity app on the Windows PC. Implementing the app using TCP/IP is an option, but I'd rather not use Wi-Fi as a means of communication due to the requirement of a wireless router (the location where we have this thing set up at the moment has a bit of a flaky Wi-Fi connection, so I don't want to rely on it if it's going to keep dropping).

avatar image
0

Answer by Neonov · Apr 17, 2020 at 09:19 AM

Hi guys, I have the same task. Have you succeeded with that? @LeeJBaxter

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by nessuka · Oct 19, 2020 at 09:32 AM

@LeeJBaxter I need to do something very similar, but I would be controlling through a tablet what is shown on a TV. Did you get a solution to your application?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

98 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Bluetooth plugin recs for transferring text file from computer to Android app 0 Answers

Using Android plugin to access android controller information. 1 Answer

Get Heart Rate from BLE Device on Windows 8? 1 Answer

Send Variables via Bluetooth Android 0 Answers

What could automatically toggle a checkbox in the PluginInspector ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges