Deploying to Android and iOS (AR Foundation) [Experimental] — MRTK2

Install required packages

  1. Download and import the Microsoft.MixedReality.Toolkit.Unity.Foundation package, from GitHub or the Unity Package Manager

  2. In the Unity Package Manager (UPM), install the following packages:

    Unity 2018.4.x

    Android iOS Comments
    AR Foundation
    Version: 1.5.0 - preview 6
    AR Foundation
    Version: 1.5.0 - preview 6
    For Unity 2018.4, this package is included as a preview. To view the package: Window > Package Manager > Advanced > Show Preview Packages
    ARCore XR Plugin
    Version: 2.1.2
    ARKit XR Plugin
    Version: 2.1.2

    Unity 2019.4.x

    Android iOS
    AR Foundation
    Version: 2.1.8
    AR Foundation
    Version: 2.1.8
    ARCore XR Plugin
    Version: 2.1.11
    ARKit XR Plugin
    Version: 2.1.9

    Unity 2020.3.x

    Android iOS
    AR Foundation
    Version: 3.1.3
    AR Foundation
    Version: 4.0.12
    ARCore XR Plugin
    Version: 3.1.4
    ARKit XR Plugin
    Version: 4.1.7
  3. Update the MRTK UnityAR scripting defines by invoking the menu item: Mixed Reality > Toolkit > Utilities > UnityAR > Update Scripting Defines

    Update Scripting Defines

Add the MixedRealityToolKit scene to your project

  1. Select Mixed Reality -> Toolkit -> Add to scene and configure

    Mixed Reality -> Toolkit -> Add to scene and configure menu option

Enabling the Unity AR camera settings provider

The following steps presume use of the MixedRealityToolkit object. Steps required for other service registrars may be different.

  1. Select the MixedRealityToolkit object in the scene hierarchy.

    MRTK Configured Scene Hierarchy

  2. Select Copy and Customize to Clone the MRTK Profile to enable custom configuration.

    Clone MRTK Profile

  3. Select Clone next to the Camera Profile.

    Clone MRTK Camera Profile

  4. Navigate the Inspector panel to the camera system section and expand the Camera Settings Providers section.

    Expand settings providers

  5. Click Add Camera Settings Provider and expand the newly added New camera settings entry.

    Expand new settings provider

  6. Select the Unity AR Camera Settings provider

    Select Unity AR settings provider

    For more information about configuring the Unity AR camera settings provider: Unity AR camera settings provider.

Note

This installation checks (when the application starts) if the AR Foundation components are in the scene. If not, they are automatically added to make it work with ARCore and ARKit. If you need to set a specific behaviour, you should add the components you need by yourself. For more information about AR Foundation components and installation, check this documentation.

Building a scene for Android and iOS devices

  1. Make sure you have added the UnityAR Camera Settings Provider to your scene.

  2. Switch platform to either Android or iOS in the Unity Build Settings

  3. Ensure the associated XR Plug-in management provider is enabled

    iOS XR Plug-in Management: XR Plug-in Management iOS

  4. Build and run the scene

See also