Compiling MirageXR - WEKIT-ECS/MIRAGE-XR GitHub Wiki

After MirageXR has been configured (see Setup, different builds can be generated. This includes the possibility to run the build process multiple times with different Brand configurations, generating different apps with different name, look, and selection of content types to be made available in the editor.

[!Caution] Don't forget to set the desired build target to either Android, iOS, or Universal Windows (Hololens). The build target Universal Windows is only available on Windows machines, not on macOS. As alternative, to at least get the edit mode preview, the Windows, Mac, Linux build target is set to show the spatial UI.

[!Note] If you want to build a branded version of MirageXR, don't forget to setup your own Brand Configuration.

Assets Mapping Table

[!Caution] This step is not needed for every build and the cached version is sufficient. Should you experience strange effects (old zombie prefabs showing in a build despite them already being changed and not showing in Unity editor play mode, a fresh build of the AssetBundles will help.

There are asset mapping tables to be set up which allow for reducing resource load in the application. To set up this required mapping table for prefab assets (using the addressable methods), Unity will need developers to configure ("build") a mapping table for where to load asset prefabs from.

For this, a UnityEditor window is available via MirageXR>Assets>Build AssetBundles, which will initiate building the AssetBundles for iOS, Android, and Hololens (WSAPlayer build target). In some cases, it may require opening the native Window>Asset Management>Adressables>Groups to create a Build>New Build.

[!IMPORTANT]
Vuforia is missing the exclude build target for visionOS and for iOS, we are only using it on WSA. This has to be manually patched before building / building assets in the Unity package cache at Library/PackageCache/com.ptc.vuforia.engine@b724a8714d15/Vuforia/Scripts/VuforiaScripts.asmdef:

    "excludePlatforms": [
        "GameCoreScarlett",
        "GameCoreXboxOne",
        "iOS",
        "LinuxStandalone64",
        "CloudRendering",
        "PS4",
        "PS5",
        "Stadia",
        "Switch",
        "tvOS",
        "visionOS",
        "WebGL",
        "XboxOne"
    ],

Set XR managers default values

If you have changed any of the settings to force UI (PlatformManager) or force a specific XR management (PlaneManager, FloorManager, ImageTargetManager, ...), then now is a good time to turn off or set them back to default.

Shaders to include

Since some gameobjects are only created programmatically, the builds not always get it right to include all required shaders. To circumvent this, it is possible to add under Project Settings>Graphics>Shader Loading>Preloaded Shaders an asset with the TrackedShaderVariants (which can be stored in the same sub group to an asset using Save to asset...). The TrackerShaderVariants asset is stored in the path Assets/MirageXR/Rendering.

Build

Switch the build target to either iOS, Android, or Universal Windows (target: Hololens) and File>Build Settings>Build. Sometimes, the files of previous builds will need to be removed to force Unity to compile everything fresh, and not use cached versions of earlier builds.

Future Outlook: Local Build Pipelines

We are working on local build pipelines, available via the menu MirageXR/Build/. This is experimental and not sufficiently configured, but it will, in the future, allow overriding build settings programmatically by code using the UnityEditor window class LocalBuildPipeline.cs.

[!Warning] The local build pipelines are not fully configured yet. Don't use.

GitHub Actions

We have set up various CI pipelines in this GitHub project that assist in building preview versions online and announcing them to the slack channel #preview-releases in the MirageXR community. These have ups and downs, but include also executing the set of unit tests. The actions are available here.