cancel
Showing results for 
Search instead for 
Did you mean: 

Oculus Core SDK v76 Bug - Compiler errors with Web(GL) target active

Mr.Watts.Quest
Honored Guest

Hi

We have a project that needs to target Meta Quest 3 as well as Web(GL) in Unity 6.1. We are aware that the Meta SDK doesn't support the WebGL target and don't intend to use it there, but apparently some of its editor-only code generates compiler errors when the target becomes active, blocking any iteration:

Library/PackageCache/com.meta.xr.sdk.core@fc2d39f84dd4/Scripts/Editor/OVRManagerEditor.cs(392,220): error CS0103: The name 'manager' does not exist in the current context

 Looking at this file, around line 86 it says:

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_ANDROID
        OVRManager manager = (OVRManager)target;
        // ...

In other words, this is missing the UNITY_WEBGL compiler directive to have this compile in, or rather should probably be present on any platform to avoid errors. The other option is to move manager one line up.

I'm currently investigating if there is a workaround, since the normal 'fix' for this is is to e.g. place define constraints on Oculus.VR.Scripts.Editor.asmdef, which Unity will not let me do because it's part of an installed dependency in the Library folder (i.e. Meta needs to do this or we need to fork it to get access to the file).

The irony is that this should be an editor-only problem, but these errors still block any WebGL builds from happening.

1 REPLY 1

Mr.Watts.Quest
Honored Guest

There appears to be one more in OVRGradleGeneration.cs: OnPreprocessBuild tries to do this:

// OpenXR Plugin will remove all native plugins if they are not under the Feature folder. Include OVRPlugin to the build if MetaXRFeature is enabled.
        var metaXRFeature =
            FeatureHelpers.GetFeatureWithIdForBuildTarget(report.summary.platformGroup, Meta.XR.MetaXRFeature.featureId);
        if (metaXRFeature.enabled && !useOpenXR)

... but metaXRFeature.enabled results in a null reference because there are no XR providers for Web. It should early out.

After fixing this one I can get the project to build. There are runtime errors as well, but those might be on us and not on the SDK.