Table of Contents

Enable AR Foundation in EasyAR projects

If you need to enable AR Foundation support in EasyAR or use other features of AR Foundation, you must correctly install and configure AR Foundation. The following content explains how to complete these operations.

Before you begin

AR Foundation version compatibility

EasyAR supports AR Foundation 5 or later.

Important

AR Foundation support is implemented through a custom camera.

When using trial products (such as personal edition license, trial XR license, or trial Mega service, etc.) on custom cameras or headsets, EasyAR Sense will stop responding after 100 seconds (Mega users can adjust the duration after approval by EasyAR business) upon each startup. There is no such limitation when using the paid version of EasyAR Sense and the paid EasyAR Mega service.

Install AR Foundation

It is recommended to refer to the AR Foundation official documentation for installing AR Foundation. Before reading, make sure to select the corresponding document version.

Unity 2022 and later versions

If no XR-related plugins have been installed in the project, you need to go to Project Settings > XR Plug-in Management and click the Install XR Plugin Management button to install XR Plug-in Management and wait for the installation to complete.

alt text

If you need to use AR Foundation on the Android platform, check Google ARCore under the Android tab and wait for the installation to complete.

alt text

If you need to use AR Foundation on the iOS platform, check Apple ARKit under the iOS tab and wait for the installation to complete.

alt text

If you need to use AR Foundation on the visionOS platform, you need to read Vision Pro project configuration.

Tip

It is recommended to keep Initialize XR On Startup checked to ensure AR Foundation can initialize at the default time.

After the installation is complete, open the Package Manager window, and you will see AR Foundation and the corresponding platform plugins appear in the list of installed packages. Note that the version numbers of these packages should be exactly the same.

alt text

Important

When installing or updating AR Foundation, ensure that the versions of Google ARCore XR Plugin and Apple ARKit XR Plugin exactly match the version of AR Foundation. Version mismatches may cause runtime errors or functional issues.

Unity 2021

In Unity 2021, you need to manually edit the Packages/manifest.json file to specify the version. Refer to the official documentation.

For example, if you want to install AR Foundation version 5.2.0 and use it on Android and iOS platforms, make sure the Packages/manifest.json file includes the following content:

{
  "dependencies": {
    ...
    "com.unity.xr.arcore": "5.2.0",
    "com.unity.xr.arfoundation": "5.2.0",
    "com.unity.xr.arkit": "5.2.0",
    ...
  }
}

Configure XR Plug-in

When using EasyAR, ARCore is usually not necessary. Therefore, ARCore should be configured as optional to avoid the application from malfunctioning on devices that do not support ARCore.

In Project Settings > XR Plug-in Management > ARCore, set both Requirement and Depth to Optional.

alt text

Caution

If Requirement is set to Required and the packaged application is installed on a device that does not support ARCore, the device will incorrectly report that ARCore is available and run with ARCore. This creates the illusion that these devices are running ARCore and malfunctioning (black screen or other abnormalities), but this is incorrect.

This phenomenon occurs because the Google Play Store prevents the installation of apps marked as requiring ARCore on unsupported devices, so these apps always assume they are running on supported devices.

Under normal configuration, these devices will determine that ARCore is not supported during session assembly and use EasyAR's functionality instead.

If needed, you can also refer to the following official documentation to further configure ARCore and ARKit. Before reading, make sure to select the corresponding document version.

Configure Universal Render Pipeline

If the current project is using URP, you need to configure the URP asset. If not configured correctly, the AR Foundation camera background may not render properly.

First, ensure that EasyAR's URP Renderer Feature is correctly configured. Refer to EasyAR's Universal Render Pipeline configuration.

Then, add ARBackgroundRendererFeature to the Renderer Features list.

alt text

As with EasyAR's URP Renderer Feature configuration, pay attention to the settings in Project Settings > Quality for different platforms. Ensure that the URP asset with ARBackgroundRendererFeature correctly configured is used on all platforms where AR Foundation is required.

Alternatively, you can refer to AR Foundation's official URP configuration documentation for configuration. Before reading, make sure to select the corresponding documentation version.

Note

EasyAR's Universal Render Pipeline configuration is still required to ensure that rendering functions related to EasyAR interfaces work properly on devices that do not support AR Foundation.

Enable EasyAR AR Foundation Support

In Project Settings > EasyAR > Sense, ensure the Unity XR > AR Foundation Support option is enabled. This option is enabled by default.

alt text

Modifying this option will trigger script recompilation, and the changes will take effect only after the compilation is complete. If Unity fails to trigger the compilation normally for any reason, you can close Unity and delete the Library/ScriptAssemblies folder to force Unity to recompile the scripts.

Tip

If EasyAR is incompatible with AR Foundation in the project and there is no need to use both EasyAR and AR Foundation simultaneously, you can disable this option.

Next steps