|
| 1 | +# How to configure MRTK for iOS and Android [Experimental] |
| 2 | + |
| 3 | +## Install Required Packages |
| 4 | + |
| 5 | +1. Download and import the **Microsoft.MixedReality.Toolkit.Providers.UnityAR** package, from [GitHub](https://github.com/microsoft/MixedRealityToolkit-Unity/releases/tag/v2.2.0) or [NuGet](../MRTKNuGetPackage.md) |
| 6 | + |
| 7 | +> [!NOTE] |
| 8 | +> After you import the the UnityAR package, you will see the following error: |
| 9 | +> *Assembly has reference to non-existent assembly 'Unity.XR.ARFoundation' (Assets/MixedRealityToolkit.Staging/UnityAR/Microsoft.MixedReality.Toolkit.Providers.UnityAR.asmdef)* |
| 10 | +". To resolve, install the correct version of ARFoundation listed below. |
| 11 | + |
| 12 | + |
| 13 | +2. In the Unity Package Manager (UPM), install the following packages: |
| 14 | + |
| 15 | + ### Unity 2018.4.x |
| 16 | + |
| 17 | + | **Android** | **iOS** | Comments | |
| 18 | + | --- | --- | --- | |
| 19 | + | AR Foundation <br/> Version: 1.5.0 - preview 6 | AR Foundation <br/> Version: 1.5.0 - preview 6 | For Unity 2018.4, this package is included as a preview. To view package: Window > Package Manager > Advanced > Show Preview Packages| |
| 20 | + | ARCore XR Plugin <br/> Version: 2.1.2 | | | |
| 21 | + | | ARKit XR Plugin <br/> Version: 2.1.2 | | |
| 22 | + |
| 23 | + |
| 24 | + ### Unity 2019.x |
| 25 | + |
| 26 | + | **Android** | **iOS** | |
| 27 | + | --- | --- | |
| 28 | + | AR Foundation <br/> Version: 2.1.4 | AR Foundation <br/> Version: 2.1.4 | |
| 29 | + | ARCore XR Plugin <br/> Version: 2.1.2 | | |
| 30 | + | | ARKit XR Plugin <br/> Version: 2.1.2 | |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +1. If using Unity 2019.x, the assembly definition file for the Unity AR provider needs to be modified to have the **UnityEngine.SpatialTracking** reference added. |
| 35 | + |
| 36 | +  |
| 37 | + |
| 38 | +## Enabling the Unity AR camera settings provider |
| 39 | + |
| 40 | +The following steps presume use of the MixedRealityToolkit object. Steps required for other service registrars may be different. |
| 41 | + |
| 42 | +1. Select the MixedRealityToolkit object in the scene hierarchy. |
| 43 | + |
| 44 | +  |
| 45 | + |
| 46 | +2. Select **Copy and Customize** to Clone the MRTK Profile to enable custom configuration. |
| 47 | + |
| 48 | +  |
| 49 | + |
| 50 | +3. Select **Clone** next to the Camera Profile. |
| 51 | + |
| 52 | +  |
| 53 | + |
| 54 | +4. Navigate the Inspector panel to the camera system section and expand the **Camera Settings Providers** section. |
| 55 | + |
| 56 | +  |
| 57 | + |
| 58 | +5. Click **Add Camera Settings Provider** and expand the newly added **New camera settings** entry. |
| 59 | + |
| 60 | +  |
| 61 | + |
| 62 | +6. Select the Unity AR Camera Settings provider |
| 63 | + |
| 64 | +  |
| 65 | + |
| 66 | + For more information about configuring the Unity AR camera settings provider: [Unity AR camera settings provider](../CameraSystem/UnityArCameraSettings.md). |
| 67 | + |
| 68 | +## Building a Scene for Android and iOS devices |
| 69 | + |
| 70 | +1. Make sure you have added the UnityAR Camera Settings Provider to your scene. |
| 71 | + |
| 72 | +2. Switch platform to either Android or iOS in the Unity Build Settings |
| 73 | + |
| 74 | +When you switch the platform you should see the MRTK Project Configurator Window with settings for your chosen platform. Click Apply to enable platform specific settings. |
| 75 | + |
| 76 | +iOS Project Configurator Settings |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +3. There are no additional steps after switching the platform for Android. |
| 81 | + |
| 82 | +4. If the platform is iOS, Edit > Project Settings > Player > Other Settings, under the Optimization header, **uncheck** Strip Engine Code |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +> [!NOTE] |
| 87 | +> Unchecking Strip Engine Code is the short term solution to an error in Xcode [#6646](https://github.com/microsoft/MixedRealityToolkit-Unity/issues/6646). We are working on a long term solution for MRTK 2.3.0. |
| 88 | +
|
| 89 | +5. Build and run the scene |
| 90 | + |
| 91 | +## See Also |
| 92 | + |
| 93 | +- [Unity AR Camera Settings](../CameraSystem/UnityArCameraSettings.md) |
0 commit comments