Unable to place Unity UI on top / in front of a webview (webview is always covering Unity UI)

Symptoms

  • Other Unity UI elements or objects aren't being shown in front of a CanvasWebViewPrefab, even if they are placed in front of the CanvasWebViewPrefab in the Canvas.
  • Native 2D Mode is enabled, or the issue occurs when building for WebGL.

Cause

Native 2D Mode works by positioning a native 2D webview in front of the Unity game view, so other Unity objects or UI elements cannot be placed in front of the webview.

Resolution

Options:

  1. The first option is to disable Native 2D Mode. Note that this option is unavailable for 2D WebView for WebGL, which only supports Native 2D Mode.
  2. Another option is to redesign your UI so that other Unity objects don't need to be placed in front of the webview. For example, you could add additional HTML elements to the web page in the webview instead.