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)?
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.
Hi guys, I have the same task. Have you succeeded with that?
@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?