简体   繁体   中英

Hololens 2 tap and head movement works in Unity but not on HoloLens

While building an app for the HoloLens 2 in Unity 2019, I started using MRTK (Mixed Reality Toolkit) . I repeatedly ran into problems where the app would work perfectly, as expected in Unity while running the game preview. Once I built and deployed the app to an actual HoloLens 2, however, it would not run correctly.

At first, the app was in a window similarly to here . Then, once the window was removed, the app moved as if it was stuck to the user's face instead of staying still as the user moved around it. Finally, the hand and arm recognition did not work.

I followed all of the code examples , and I know my scripts are working because they work as expected in Unity. So what is wrong? Why does the app work in Unity but not on the HoloLens itself?

This took a lot of poking around and trial and error because the issues were not directly related to my code, but rather the configuration of MRTK. These problems were because of the transition between the (now) legacy XR (Mixed Reality) system in Unity, and the new XR system. If you followed the setup on this page , you are using the legacy XR system and will need to transition to the new system. Follow the steps here to transition between the systems. Also make sure to add a TrackedPoseDriver to the camera,as described here .

Note that starting in Unity 2020, the new XR management system will be the only option in Unity, so new projects started on that version going forward should not suffer this issue.

Hopefully this experience helps others avoid the same issues!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM