Table of Contents

Initialize EasyAR Sense with license key

To use EasyAR in Unity, initialize EasyAR Sense with a license key to activate functionality. There are two initialization methods: automatic and manual.

After successful initialization, you can see EasyAR Sense version and platform information in the Unity console or system logs, for example:

EasyAR Sense (Android-arm64) Version 4.7.0.11800-cf8e24e30

Before starting

  • EasyAR Sense License describes how to obtain an EasyAR Sense license (license key). Before initializing EasyAR Sense, prepare an appropriate license based on actual device usage and development stage.

Automatic initialization

Automatic initialization applies to most usage scenarios.

Open EasyAR Global Settings, check the Initialize On Startup option, and fill in EasyAR Sense License > LicenseKey

alt text

Automatic initialization occurs at Unity's BeforeSceneLoad timing.

Note

Licenses used in the editor don't verify application package names. A license working in the editor might still fail when running in a packaged platform app. Pay attention to two situations:

  1. The package name in the license should match the bundle id/package name in Unity Player Settings.
  2. If the package name is modified in gradle or XCode projects after Unity packaging. Use the package name from gradle or XCode in Unity.

[Optional] Manual initialization

Manual initialization is mainly used for custom workflows, such as displaying user privacy policies before calling EasyAR interfaces (see Compliance Guide).

Open EasyAR Global Settings, uncheck the Initialize On Startup option.

alt text

Then use the EasyARController.Initialize() interface for manual initialization.

You can pass the license as a parameter:

EasyARController.Initialize("my-license");

Or use the license filled in EasyAR Global Settings:

EasyARController.Initialize();
Important

EasyARController.Initialize() must be called before starting ARSession.

In special cases requiring multiple EasyARController.Initialize() calls, ensure EasyARController.Deinitialize() is executed after each initialization.

Troubleshooting initialization failures

If similar information doesn't appear in logs after running a scene containing ARSession, initialization has failed.

EasyAR Sense (Android-arm64) Version 4.7.0.11800-cf8e24e30

In Unity Editor, you might see popups like:

alt text

Note

Carefully read the text in popups - not all indicate initialization failure.

Common error messages and causes:

  • EasyARSettings is not found
    • EasyAR Global Settings resource file not created (common when license is missing)
  • License Key is empty
    • License not filled in EasyAR Global Settings, or multiple resource files exist
  • EasyARController.Initialize is not called (InitializeOnStartup = false)
    • Manual initialization not called at correct timing
  • EasyAR stops after script change in play mode
    • Script modified during editor runtime. Restart to resolve