This Unity project demonstrates how to view and interact with web content on Apple Vision Pro using Vuplex 3D WebView with Unity's RealityKit app mode for visionOS. All you need to do is import 3D WebView for visionOS into the project and then build one of the following scenes:
- RealityKitWindowedWebViewExample scene: demonstrates using VisionOSWebView.CreateInWindow() to open a webview in a native visionOS (SwiftUI) window.
- RealityKitCanvasWebViewExample scene: demonstrates using a CanvasWebViewPrefab to display and interact with web content in a Unity UI Canvas.
- Created a new project with Unity 6 (6000.0.25) using the 3D URP project template.
- Opened the Unity Package Manager and did the following:
- Imported v2.3.1 of the com.unity.polyspatial.visionos package and its dependencies.
- On the page for the com.unity.polyspatial package, clicked on the "Samples" tab and clicked "Import" button for "Unity PolySpatial Samples".
- To create the RealityKitWindowedWebViewExample scene:
- Made a copy of PolySpatial's Manipulation sample scene and named it RealityKitWindowedWebViewExample.
- Added a RealityKitWindowedWebViewExample.cs script that uses the VisionOSWebView.CreateInWindow() API to open a windowed webview.
- Removed unneeded objects from the RealityKitWindowedWebViewExample scene.
- To create the RealityKitCanvasWebViewExample scene:
- Made a copy of PolySpatial's GUI sample scene and named it RealityKitCanvasWebViewExample.
- Added a CanvasWebViewPrefab to the RealityKitCanvasWebViewExample scene's Canvas and set its Initial URL field.
- Added a RealityKitCanvasWebViewExample.cs script that demonstrates how to use 3D WebView's scripting APIs.
- Removed unneeded objects from the RealityKitCanvasWebViewExample scene.
- Updated the following project settings:
- "XR Plug-in Management": enabled the "Apple visionOS" XR plugin
- "XR Plug-in Management" -> "Apple visionOS":
- Changed the App Mode to "RealityKit"
- Added values for "Hand Tracking Usage Description" and "World Sensing Usage Description"
- Enabled "IL2CPP Large Exe Workaround"
- Player Settings:
- Disabled "Show Splash Screen"
- Changed "Color Space" to "Linear"
