Symptoms
- Your scene includes a WebViewPrefab or CanvasWebViewPrefab.
- The web page loads but clicking and scrolling don't work.
Cause
- The scene is missing an Event System with a compatible input module.
- Or (for WebViewPrefab) the main camera is missing a Physics Raycaster.
- Or (for CanvasWebViewPrefab) the Canvas is missing a Graphic Raycaster.
Resolution
3D WebView's prefabs automatically detect input from Unity's Event System like described in this article.
A scene must include the following in order for clicking and scrolling to work:
- The scene must include an Event System with an input module.
- If using WebViewPrefab, the main camera must have a Physics Raycaster attached to it. Note that if you're using the Meta Quest Integration SDK, you must use an OVRPhysicsRaycaster instead of a standard Physics Raycaster.
- If using CanvasWebViewPrefab, the Canvas must have a Graphic Raycaster attached to it. Note that if you're using the Meta Quest Integration SDK, you must use an OVRRaycaster instead of a standard Physics Raycaster.
3D WebView's demo scenes use Unity's StandaloneInputModule, which works great for desktop and mobile applications. For virtual and augmented reality, your VR or AR SDK usually includes an input module. For reference, please see this list of input modules and following webview example projects:
- Meta Quest example
- XR Interaction Toolkit example
- AR Foundation example
- visionOS examples for virtual reality and mixed reality
- Hololens example (MRTK2)
If an example project isn't listed for your VR or AR SDK, then the following tips may be helpful:
- Search your VR or AR SDK for a demo scene that demonstrates interacting with a UI Canvas. If you locate such a scene, try adding a CanvasWebViewPrefab to the scene's Canvas. You can also try adding a PhysicsRaycaster to the scene's main camera and adding a WebViewPrefab to the scene.
- Search your SDK's documentation or files for the terms "InputModule" or "IPointerClickHandler" to locate information about its input module.
If your project or SDK implements its own proprietary event system that isn't compatible with Unity's event system, you can still enable clicking by using the approaches described here.