visionOS Build Fails Due to OnDemandResources?

In attempting to build an initial Xcode project from a recently updated Unity port project I am getting the following error that does not make sense to me as there are no OnDemand Resource settings for visionOS in the editor.

Exception: Please configure resource variant 'hd' in player settings
UnityEditor.iOS.OnDemandResourceHelper.BuildCollectedResources (UnityEditor.Modules.BuildPostProcessArgs args, System.Boolean useOnDemandResources, System.String companyName) (at <3dd88c6de12a4c4eaa93ea2024962fbe>:0)
UnityEditor.VisionOS.VisionOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <0c1edcfdb4884c8281b11eb78f3ba24d>:0)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
Test.BuildSystem.BuildMaker:BuildUnityProject(BuildConfiguration, String) (at Assets/Test/Build System/Editor/BuildMaker.cs:363)
Test.BuildSystem.BuildMaker:RunBuilds(List`1, Boolean) (at Assets/Test/Build System/Editor/BuildMaker.cs:173)
Test.BuildEditorWindow:OnGUI() (at Assets/Test/Build System/Editor/BuildEditorWindow.cs:76)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

Interestingly, I downloaded the visionOS sample and was able to produce an Xcode project without issue; although, I couldn’t get it to build in Xcode.

How do I resolve this build error?

For vision OS support we are using some of the core architecture from the iOS build platform. On demand resources is a single flag in player settings, I would try disabling it on the iOS platform and see if that works. It also might be related to asset bundles in general.

Thanks, @DanMillerU3D.

Unfortunately, I did check the iOS build settings and the Use on-demand resources options was not checked. However, I did find an odd workaround that allowed me to build an Xcode project. Here is what I did:

  1. Go to the iOS Player Settings.
  2. Check the Use on-demand resources checkbox.
  3. Scroll down and attempt to expand the Variant map for app slicing section that will appear after the on-demand resources box is checked.
    a. Note that the editor spew a large number of errors at this point. To get around the errors, select a different Project Settings section then select the Player section again.
  4. With the Variant map for app slicing section expanded, click the + button and select hd to add it.
    a. Note that both hd and sd will already be shown in the Variant map for app slicing list; you must add duplicates for the workaround to “work”.
  5. Press the + button again and select sd to add it.
  6. Uncheck the Use on-demand resources checkbox.
  7. Re-run the build process and note that it now works.

Using this workaround adds the following in the ProjectSettings.asset:

  - variantTagName: hd
    - {}
    - {}
  - variantTagName: sd
    - {}
    - {}

Possibly the ProjectSettings.asset should already have these values in it? Maybe they are not there due to this project being older?

1 Like