Closed Polyrhythm closed 8 years ago
Try enabling Human Interface Device as well.
On Sun, Jul 17, 2016, 9:47 PM Polyrhythm notifications@github.com wrote:
I have a BT keyboard that works great with my Hololens. Doesn't work at all in Unity. I have enabled the bluetooth option in Project Settings. What else do I need to do? Nothing much came up for a Google search of "UWP Unity bluetooth" - just Android or iOS stuff.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/HoloToolkit-Unity/issues/122, or mute the thread https://github.com/notifications/unsubscribe-auth/AG3e5Rd6C92tHC2UATB6pj_qyizNnZNUks5qWulcgaJpZM4JOYP2 .
Just tried it, but no dice!
BT keyboard support is absolutely crucial for my app, as it involves a lot of typing. :(
I am sure of BT keyboard support. I am not in a position to test on any of my projects at the moment, but Holo Copter works fine with keyboard. I am using the Microsoft Designer set, not sure if that makes a difference or not. Mid day tomorrow I can look in it deeper, assuming the question has not been answered by that point
On Sun, Jul 17, 2016 at 10:01 PM, Polyrhythm notifications@github.com wrote:
Just tried it, but no dice!
BT keyboard support is absolutely crucial for my app, as it involves a lot of typing. :(
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Microsoft/HoloToolkit-Unity/issues/122#issuecomment-233221412, or mute the thread https://github.com/notifications/unsubscribe-auth/AG3e5RqeOHpeaoMi1_pinbCdQEPitW8eks5qWuycgaJpZM4JOYP2 .
Jason Odom Thought Experiment 205-223-1011 Jasonodom23@gmail.com
Edit:
Looks like Unity is seeing the keyboard events with Input.anyKeyDown
- I was debugging through Visual Studio and the device. However, there is some issue where Unity can't automatically translate those inputs to an InputField
in the 3d world like it normally does with keyboard input. I still have the issue of having no way to add characters to an InputField
.
I went deeper with this and tried to simulate keyboard presses based on the keycode Unity detected was being pressed with this library. The goal was to at least see if I could get Unity to recognize the synthetic keyboard events. It works fine in the Unity Editor. In the actual device, I get the following error:
Exception: The key down simulation for VK_A was not successful.
at WindowsInput.InputSimulator.SimulateKeyDown(VirtualKeyCode keyCode)
at Console.Update()
at Console.$Invoke13(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: <Unknown> Line: 0)
There is definitely screwy stuff going on between UWP/Unity keycodes or keyboard input.
TL;DR Unity is getting the correct keycode events, but not propagating them correctly to Inputs. If I attempt to create synthetic keyboard events, that also fails completely in the device.
That library ties into SendInput (Win32) which isn't supported in the Universal App space, so that was a bad test.
I have a Bluetooth keyboard I can try binding to this now, let's see here...
Works here. I wired up a simple example for you to play with https://1drv.ms/u/s!AnjdAnZZcu-GotZ0FsCO1LwrouyoTA.
It uses Input.GetKeyDown to detect the letter 'A' or 'R' and adds or removes, respectively, a random cube in front of the camera. Tested in Unity 5.4.0b22-HTP and HoloLens. (I was too lazy to fix the pink cubes on HoloLens.)
void Update()
{
if(Input.GetKeyDown(KeyCode.A))
{
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.tag = "Cubes";
var xform = cube.GetComponent<Transform>();
xform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
xform.position = new Vector3(Random.Range(-2f, 2f), Random.Range(-2f, 2f), Random.Range(-2f, 2f));
cube.GetComponent<Renderer>().material.color = Random.ColorHSV();
}
else if(Input.GetKeyDown(KeyCode.R))
{
GameObject.Destroy(GameObject.FindGameObjectWithTag("Cubes"));
}
}
Hm, saw your notes with InputField and decided to retest. There's a Unity build that fixes some issues surround InputField and keyboard input (build 24) and with the "HoloLens Input Module" component added to the InputField, everything appears to be working.
The Hololens Input Module
was the missing key. Thank you!
I have a BT keyboard that works great with my Hololens. Doesn't work at all in Unity. I have enabled the
bluetooth
option in Project Settings. What else do I need to do? Nothing much came up for a Google search of "UWP Unity bluetooth" - just Android or iOS stuff.