The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
How to use inputs from Unity?
Hi there,
Since the last update I'm able to test my work from the Unity Editor, which is great. However I can't test input. My game works with Gamepad, Keyboard or motion controller, but when I try it from Unity, my gamepad or keyboard don't have the focus. Do you know what do I have to do to get it working?
I have also another question, is it possible to simulate the motion controllers? Is it mapped in Unity like the Oculus Touch and the Vive's wands? How to test them?
Thanks!
French XR/MR developer / Indie Game Developer
Best Answer
-
OptionsJerrith ✭
So, there's a workaround (at least for play in editor - 2017.2.0b5, haven't tried built versions yet), but it's painful. Each time you start your Unity app, after you've put your headset on, press [Win] + Y to give control to the desktop, and then click on the Unity Editor again.
Important note: If you take your headset off and put it back on, you'll lose input again. You may want to tape over the sensor to avoid this.
5
Answers
Have you tried the latest MRTP13 ?
Currently, only mouse, keyboard and Gamepad input simulation is supported. If you get the motion controller and complete the setup with your PC, you should can test them in Unity Play mode.
Hi,
I don't have access to this version, but I can't use anything that Unity 2017 because all my code was converted to C# 4.6. So if I understand, this input issue is related to Unity 2017.2 beta 4 and the MRTP13 allows devs to use a gamepad or the mouse from the Unity Editor in their application?
French XR/MR developer / Indie Game Developer
@FranklinChen where does one get access to MRTP13? We are using 2017.2 and having a similar problem that we can't get controllers to work in Play mode. Forum post here.
@anandx it looks like this issue is for all types of inputs I suspect a focus issue. Because Unity is a Win32 apps and YOU are in VR, so the focus is set on the VR content and not the Unity Editor. In fact if click using your mouse, you'll hear few sounds.
French XR/MR developer / Indie Game Developer
untested (i just understood how to build) but could it maybe work using 'XR.WSA.Input' ? https://docs.unity3d.com/2017.2/Documentation/ScriptReference/XR.WSA.Input.SourcePressedEventArgs.html
Edit : oh i misunderstood, the issue only happens in editor ?
Please see this document: Install the tools
You can tell your Microsoft contact to find the right person to help you on this request.
HoloToolkit-Unity MRTP13 is released but there's a note that says :
So, there's a workaround (at least for play in editor - 2017.2.0b5, haven't tried built versions yet), but it's painful. Each time you start your Unity app, after you've put your headset on, press [Win] + Y to give control to the desktop, and then click on the Unity Editor again.
Important note: If you take your headset off and put it back on, you'll lose input again. You may want to tape over the sensor to avoid this.
What about launching from an actual app and now from the editor?
Microsoft HoloLens Agency Readiness Program Partner
Developer, Immersive Experiences at Valorem | LinkedIn Profile
Moderator for Microsoft's open source HoloToolkit for Unity
This issue should be fixed in the latest Unity 2017.2.0b10 build. It was just an issue with the game window losing focus when launching into the MRP.
@Jesse_McCulloch Yeah I tried using b10 but I'm not running from the editor, but from a build launched through the Mixed Reality Portal. I kept getting
Unimplemented Controller type Detected: Xbox Wireless Controller
in the output window when debugging from Visual Studio.I just ported stuff from a previous version of Unity that was working fine, but now seems to be broken.
Microsoft HoloLens Agency Readiness Program Partner
Developer, Immersive Experiences at Valorem | LinkedIn Profile
Moderator for Microsoft's open source HoloToolkit for Unity
Found this old Thread over on the unity forums that's relevant to the issue.
Microsoft HoloLens Agency Readiness Program Partner
Developer, Immersive Experiences at Valorem | LinkedIn Profile
Moderator for Microsoft's open source HoloToolkit for Unity
Another relevant Thread
Microsoft HoloLens Agency Readiness Program Partner
Developer, Immersive Experiences at Valorem | LinkedIn Profile
Moderator for Microsoft's open source HoloToolkit for Unity
I figured it out. In the editor the string name for the controller is different than in the build.
In Editor the Xbox One S Bluetooth Controller is "Xbox Bluetooth Gamepad"
In the UWP runtime it's "Xbox Controller" and "Xbox Wireless Controller"
(Seems to be enumerated twice for some reason)
Microsoft HoloLens Agency Readiness Program Partner
Developer, Immersive Experiences at Valorem | LinkedIn Profile
Moderator for Microsoft's open source HoloToolkit for Unity
How did you find out which name it gets in UWP ?