This Unity project demonstrates how to use the Vuplex 3D WebView asset with Hololens. It includes Microsoft's Mixed Reality Toolkit 2 (MRTK2), so the only thing you must import 3D WebView for UWP / Hololens. Note: there is not currently an example project for using 3D WebView with MRTK3. For more details, please see this article.
- The project is already set up for Hololens 2 by default. So, if you're targeting Hololens 2, all you need to do is import 3D WebView for UWP / Hololens and then build the HololensWebViewDemo scene.
- If you're targeting Hololens 1 instead, you must also do the following:
- Change the project architecture from ARM64 to x86
- Update the HololensWebViewDemo scene's MixedRealityToolkit object to use a Hololens 1 configuration profile (e.g. DefaultHololens1ConfigurationProfile).
- For tips on deploying the project to a headset, see this Microsoft article.
- Created a new project with Unity 2020.3.24.
- Installed MRTK v2.8.0.
- Imported 3D WebView for UWP / Hololens (.gitignore).
- Created a new scene named HololensWebViewDemoScene that combines 3D WebView's WebViewPrefab and Keyboard components with the needed components from MRTK.
- Applied the following settings to the scene's MixedRealityToolkit object:
- Cloned the DefaultHololens2ConfigurationProfile profile in order to disable the diagnostics overlay
- UWP Build Settings:
- Architecture: ARM64
- Build Type: XAML Project (this is required to support webviews)
- Build and run on: USB Device
- UWP Player Settings:
- Other Settings:
- Auto Graphics API: disabled
- Graphics APIs: Direct3D11
- Graphics Jobs: disabled (required for Hololens 2)
- Active Input Handling: Both
- Publishing Settings:
- Capabilities:
- InternetClient
- SpatialPerception
- Capabilities:
- XR Plug-In Management:
- Enable the OpenXR provider
- Under the OpenXR provider, enable "Microsoft Hololens feature group"
- Other Settings:
The HololensWebViewDemo scene uses a WebViewPrefab, but you can make the following modifications to the scene to make it use a CanvasWebViewPrefab instead:
- Copy the Canvas object from 3D WebView's CanvasWorldSpaceDemo scene, paste it into the HololensWebViewDemo scene, and place it at the position (0, 0, 1).
- Disable the scene's SceneManager game object (because it contains the script that instantiates a WebViewPrefab).
- On the Canvas object, click the "Convert to MRTK Canvas" button.
After these modifications, you can build the scene and interact with the canvas's CanvasWebViewPrefab and CanvasKeyboard.
The Mixed Reality Toolkit library located in the Assets/MRTK directory is Copyright © Microsoft Corporation and is licensed under the MIT License.
All other code and assets are Copyright © Vuplex, Inc and licensed under the MIT License.