3D WebView for visionOS (Web Browser)

Easily display and interact with web content in 3D or 2D using the web browser plugin trusted by developers. See the developer site for full documentation.

🌐  Load a webpage from a URL or HTML string

📺  Watch videos and YouTube

<>  Create UIs with HTML

⚡️  Get started fast with the 3D WebViewPrefab and 2D CanvasWebViewPrefab, which render to a Texture2D and handle user interactions (click, scroll)

⌨️  Type with the native visionOS keyboard

• C# source code for a unified API that works seamlessly across Windows, macOS, Android, iOS, visionOS, WebGL, and UWP (each platform sold separately)

• Powered by WKWebView

• Comprehensive APIs for controlling the browser and listening to browser events

Execute JavaScript

Send messages from JavaScript to C# and vice versa

• View and create PDFs

• Integrate with OAuth

• Includes additional APIs for platform-specific features

• Supports transparent pages

• Supports both the Metal and RealityKit app modes (see the section below for limitations with RealityKit)

• Open a webview in a native visionOS window in the RealityKit app mode with VisionOSWebView.CreateInWindow()


Examples

• visionOS examples for Metal and RealityKit


System requirements

• Unity 2022.3.19 or newer

• com.unity.xr.visionos package v1.1 or newer

• Adds < 3 MB to the app's size


Limitations with RealityKit

This package currently has the following additional limitations when targeting the RealityKit app mode due to limitations of Unity PolySpatial. I plan to address some of these limitations soon in future releases of this package. In the meantime, the recommended approach for RealityKit is to use VisionOSWebView.CreateInWindow() to create a webview in a native visionOS window, which doesn't encounter these limitations.

WebViewPrefab renders, but it's currently unable to automatically detect input (clicking and scrolling) through Unity's event system. I will be working to fix this limitation soon. In the meantime, the application can still trigger input programmatically by calling IWebView.Click() and Scroll(), or by overriding the prefab's IPointerInputDetector.

• WebViewPrefab doesn't support video playback with RealityKit because Unity PolySpatial doesn't support custom shaders, which are needed for 3D WebView's fallback video implementation.

• CanvasWebViewPrefab doesn't currently render because Unity PolySpatial doesn't support the RawImage component.


Important notes and limitations

• This package only supports visionOS. To support other platforms, you can install additional 3D WebView packages, and you can save money on multiple packages by buying a bundle. All of the 3D WebView packages work seamlessly together, so all you need to do is install them into the same project, and then 3D WebView automatically detects and uses the correct plugin at runtime and build time.

• 3D WebView's native visionOS plugins are provided as precompiled libraries, and the native source code for them is not provided.

• 3D WebView's native visionOS plugins can't run in the editor, so a mock webview implementation is used by default while running in the editor. However, you can actually load and render real web content in the editor by also installing 3D WebView for Windows and macOS into the project. You can save money by buying both packages together in a bundle.

• When not running in a native window created with VisionOSWebView.CreateInWindow(), this package has the following limitations:
    ◦ Some 3rd-party JS video widgets don't function as expected. Also, on YouTube, the video resolution is 360p (640 x 360 pixels) and cannot be changed. For more details, please see this article.
    ◦ The web rendering frame rate is relatively slow (<15 FPS) due to visionOS limitations. The exception to this is video, which is rendered at a high frame rate.
    ◦ WebGL content isn't rendered.
    ◦ Scrollbars aren't rendered.
    ◦ Some HTML5 widget popups (like date picker inputs) aren't rendered. For more details, please see this page.

WebViewPrefab and CanvasWebViewPrefab are unable to detect hovering from the user's eye sight because visionOS doesn't allow application's to detect where the user is looking. However, a webview created with VisionOSWebView.CreateInWindow() automatically detects and reacts to hovering from the user's eye sight.

• Also supports running in the visionOS simulator.

• The visionOS plugin embeds PDF.js from Mozilla, so you must display a copy of its included Apache 2.0 license in your visionOS app's about page or credits.