Search code examples
unity-game-engineoculus

WebGL builds and VR/Oculus build in same project


I have a project I intend to have two clients ; a VR client and a WebGL client. I am using the Oculus Integration package as well to build to Oculus Quest.

While everything runs correctly in Android, when I try to build the project in WebGL, I have an error concerning the Microphone class.

When stubbing it, build work but the WebGL player cause the following error : "To use dlopen, you need to use Emscripten's linking support"

This error looks to be caused by Oculus Integration, because when removed, the player works successfuly.

Is there a way to make WebGL and Oculus Integration work in the same project ? There is very few things different between clients, so I'd rather not having separate projects, because sharing code is such a chore in Unity.

Thanks !


Solution

  • I eventually worked around by making actually two separated projects ; a WebGL and a Oculus. My assets got on both projects using a folder with logical links, and only the Oculus project had the Oculus integration & Unity XR dependencies installed.

    For the few of my scripts depending on XR, I used #if UNITY_WEBGL/#if !UNITY_WEBGL to disable them in the WebGL project.