WebView isn't rendering

Hi!

I've been trying to implement ML's WebView for a few days now.
However, I always get a black screen. So, when I decided to run the ML Example Project scenes, I got the same result.

The console returns 2 warnings and 1 error related to what seems to be a rendering issue?

Unity Version: 2022.2.6f
ML2 OS: 1.2.0-dev2
MLSDK Version: 1.5.0
Host OS: Windows 11

Error messages from logs:

AR Foundation is installed, but there is an XROrigin and no ARCameraBackground component in WebView attached to the camera. Video pass-through will be disabled without this component.
UnityEditor.Build.BuildPipelineInterfaces:OnSceneProcess (UnityEngine.SceneManagement.Scene,UnityEditor.Build.Reporting.BuildReport)

AR Foundation is installed, but there is an XROrigin and no ARCameraManager component in WebView attached to the camera. Video pass-through will be disabled without this component.
UnityEditor.Build.BuildPipelineInterfaces:OnSceneProcess (UnityEngine.SceneManagement.Scene,UnityEditor.Build.Reporting.BuildReport)

DllNotFoundException: ml_ycbcr_renderer assembly: type: member:(null)
UnityEngine.XR.MagicLeap.YcbcrRenderer.Initialize (System.Boolean waitForQueueIdleOnSubmit) (at ./Library/PackageCache/com.magicleap.unitysdk@1.5.0/Runtime/APIs/NativeSurface/YcbcrRenderer.cs:83)
UnityEngine.XR.MagicLeap.MLWebView+Renderer..ctor () (at ./Library/PackageCache/com.magicleap.unitysdk@1.5.0/Runtime/APIs/WebView/API/MLWebViewYcbcrRenderer.cs:30)
MagicLeap.Core.MLWebViewScreenBehavior.CreateTexture (System.Int32 width, System.Int32 height) (at ./Library/PackageCache/com.magicleap.unitysdk@1.5.0/Runtime/APIs/WebView/Scripts/MLWebViewScreenBehavior.cs:451)
MagicLeap.Core.MLWebViewScreenBehavior.CreateWebViewWindow () (at ./Library/PackageCache/com.magicleap.unitysdk@1.5.0/Runtime/APIs/WebView/Scripts/MLWebViewScreenBehavior.cs:405)
MagicLeap.Examples.WebViewExample.CreateWebViewWindow () (at Assets/MagicLeap/Examples/Scripts/WebViewExample.cs:231)
MagicLeap.Examples.WebViewExample.Start () (at Assets/MagicLeap/Examples/Scripts/WebViewExample.cs:91)

I have a little update on this.
Seems like those errors were not the problem.
Magic Leap Sample project's web view renders without issues on the headset and simulator.
However, in my project it doesn't.
The project was created at the end of the march (not by me), and after comparing it to Magic Leap Sample project, I noticed that my project was missing a URP folder.
I tried adding it to the project but it made no difference. I was still getting a glitched web view like this -


I tried to update to 1.6 and that broke ML scripts.
Any idea what could be causing this, and is URP folder making a difference here?

I recommend upgrading your project to the latest version. If your project is based off of an older version of the Unity Example Project, then create a backup of the project and use the following steps to upgrade your project:

  1. Remove the MagicLeap folder inside your Assets folder.

  2. Remove the com.magicleap.unity sdk folder from your /Packages/

  3. Add the latest Magic Leap SDK package using the steps below:

    1. Navigate to to the Package Manager settings by selecting Edit > Project Settings from the menu. Then choose Package Manager.

    2. Select the + button at the bottom of the list. A new entry will appear as New Scoped Registry in the list.

    3. Enter the following details into the Scoped Registry:

      • Name : Magic Leap ,
      • URL : https://registry.npmjs.org
      • Scope : com.magicleap
    4. Click Apply.

    5. Now you will be able to view Magic Leap packages in the Package Manager

    6. Open the Package Manger window (Window > Package Manager).

    7. Click the Packages dropdown and select My Registries.

    8. Find and select the Magic Leap SDK package from the list.

    9. Select Download and then Import.

  4. Finally, copy the MagicLeap folder from the latest version of the Magic Leap UnityExampleProject and paste it into the current project's Assets folder.

If the problem persists, make sure the Unity URP package has been installed via the Unity Package Manager window.

Thank you very much!

Hello, i know it's an old post but I get the same error in the web view example scene as mentioned here.
I have updated the magic leap sdk to version 2.0 and fetched the latest examples from the magic leap examples repository, i noticed that a lot of examples has been removed in the 2.0 release, including the web view.

Please try using the Magic Leap 1.12.0 Unity Examples Project. Versions 2.0.0 Use the OpenXR Workflow and do not include any of the original MLAPIs

Hey @kbabilinski , thanks for the response!
On 1.12 it works great on the ML2 glasses but on the app simulator I get the same error as the post author:
DllNotFoundException: ml_ycbcr_renderer assembly: type: member:(null)

May be worth checking.

Thank you for the information, the web view API is not supported in App Simulator . However, there are alternative solutions on the Unity Asset store that support both Standalone and Android Platforms

1 Like

This topic was automatically closed after 11 days. New replies are no longer allowed.