Get started with EasyAR Mega Unity development using examples
This tutorial explains how to configure and run the EasyAR Mega Unity example to quickly get started with EasyAR Mega development.
Before you begin
Before reading this article, make sure you have completed the following:
- Have a valid cloud localization library.
- Install Unity (2021.3.30 LTS or later). It is recommended to use the latest version of Unity 2022.3 or Unity 6.3.
- Import the
com.easyar.sense-**.tgzandcom.easyar.mega-**.tgzpackages as described in Enable Mega.
Example usage method (six steps)
The following will introduce how to configure and run the core example MegaBlock_Basic of EasyAR Mega in six steps.
Step 1: Import samples
Note
If all samples have been imported via **All Samples**, you can skip this step.
- Use the menu
Window>Package Managerto open the Package Manager, selectEasyAR Sense Unity Plugin, and expand all samples in the Samples section on the right. - Choose a sample (e.g.,
MegaBlock_Basic) and click Import.

Note
- This tutorial cannot be directly applied to head-mounted devices, but you need to understand the process using mobile development before developing for head-mounted devices.
- If you have previously imported samples from an older version of the SDK, you need to delete the old samples and re-import them after upgrading the SDK.
Step 2: Fill in the license key and configure Mega cloud localization service
- Select
EasyAR>Sense>Configurationfrom the menu bar;

- Paste your License Key in the opened Project Settings panel;

Tip
EasyAR Sense License can be created from the EasyAR Developer Center. For first-time use, follow these steps to create one:

- Create
EasyAR Sense 4.x Personal Edition - Select
Nofor sparse spatial map - Fill in the application name freely, and enter
com.mycompany.myprojectfor Bundle ID and Package Name - Select the newly created License, then click the copy button on the right

Note
Bundle ID and Package Name can be changed later, but the number of changes is limited. If you have a specific application package name, you can also enter your own.
There is no limit to the number of personal editions created. Other types can be created as needed for formal use.
- Configure the information of your Mega cloud localization library in the
Mega Blocksection of the Project Settings panel;

Tip
Mega cloud localization library configuration can be obtained from the EasyAR Developer Center.

Ensure your API Key has permissions for Mega Block. If not, make changes or create a new one.

Step 3: Place 3D content
Right-click on a blank area in the
Hierarchypanel to add the Block viewer tool (Unity development);

Access the Mega localization service;
- Select the
EasyAR.Mega.BlockViewer (Dev)node, and fill in your EasyAR account information in the Inspector panel to log in;

- Click the button on the right side of Mega Cloud Service;

- Select the
Mega localization serviceyou want to use and click OK.

- Select the
Load Block
After selecting the service, the Block list in the current library will be displayed under the
MegaBlocksnode and shown in the tool panel. Click Load to select the Block:

After loading, the Block will be displayed in the
Scenewindow. You can operate in theScenewindow to adjust the viewing angle and position. Also, check whether the Block file is usable (e.g., whether the Block coordinate system is normal, whether there are layers, whether it is too blurry or damaged to find a position to place AR resources, etc.).

Place 3D content
At this point, you can refer to the Block to place 3D objects.

Note
- 3D objects must be placed under the automatically generated
MegaBlocks>Block_*node to ensure the rendering position of the virtual content is correct at runtime. - Do not modify the name of the
Block_*node or itslocal transform, as it is automatically managed by the tool.
- 3D objects must be placed under the automatically generated
Step 4: Configure MegaTracker
Configure Block Root;
Expand
AR Session, selectMega Block Tracker, and setBlock Rootto theMegaBlocksnode generated by the tool.

Step 5: Modify player configuration
In the Unity menu, go to File > Build Settings > Player Settings, click the Android icon to bring up the corresponding settings for the Android platform.

Change the Package Name to the Package Name displayed on the License Key page.

Tip
For example, if the Package Name you entered when creating the License Key was
com.mycompany.myproject, you must set the Package Name here tocom.mycompany.myproject, otherwise it will fail to run.Change the Minimum API Level to
API Level 21or higher.
Change the Scripting Backend to
IL2CPPand checkARM64inTarget Architecture.
Step 6: Build and run
- Add the current scene to
File>Build SettingsorBuild Profiles>Scene List; - Switch to the target platform (e.g., Android/iOS) and check if the bundle ID and license key match;

- Click Build And Run.

The live-captured running effect is as follows:
About the yellow text on the screen
During runtime, you may see two instances of yellow text displayed on the screen.
Simulation run warning message
It appears at the bottom of the screen:

This warning appears because, by default, the app can run without being on-site. It has a slight impact on the app's performance. If you happen to be using it on-site, you can modify the MegaTracker configuration before building.
Diagnostic information
It appears at the top of the screen and is used to understand the session's status and issues. It is recommended to keep it displayed during development and testing:

You can refer to Diagnostic information in the scene to quickly learn how to configure and use this diagnostic information.
Next steps: From beginner to master
Congratulations! By following the steps above, you have successfully run the core samples of EasyAR Mega in 10 minutes, experiencing the charm of spatial positioning and AR content overlay firsthand.
Now that you have mastered the basics. If you want to:
- Build more stable and efficient AR applications
- Achieve complex effects like virtual-real occlusion and content alignment
- Debug when you don’t have the device or can’t go on-site
Refer to the following in-depth guides, which will help you solve practical problems during development.
Development advanced
If you want to learn about the complete project configuration, you can refer to the following:
If you want to further understand how to use EasyAR, you can start here:
At the same time, it is recommended to read the following to assist your development and debugging:
Fine-grained control of Mega features
The following content will help you better use Mega in your application:
- Onsite and simulation
- ARSession best practices
- Adding tracking targets
- Creating 3D content aligned with the real world
- Environment occlusion (Occlusion)
- Controlling the tracking process
The following content will help you verify Mega features without visiting the site:
Advanced topics
The following content is more suitable for reading after having some experience with EasyAR.
If you want to run EasyAR Mega on a headset, you can refer to the following:
If you want to use AR Foundation, you can start here:



