Table of Contents

Enable the Mega Editor Tool

This article describes how to enable the Mega editor tool in the Unity editor to facilitate the placement of 3D content aligned with the real scene.

Before You Start

Note

The following content and tools are only applicable to the process of developing Unity applications using EasyAR Mega. The plugin version must be >= 4003. For plugin versions 4.7 - 4002, the tool is already enabled when adding a Mega tracking target in the editor.

If you are developing a mini-program, refer to Create and Upload Annotations Using the Unity Editor (Mini-program Development).

The content of this article requires the following Unity packages to have been imported into the project:

  • com.easyar.sense
  • com.easyar.mega

Create the Editor Tool

Select the tracking target in the editor and click the Create Editor Tool button.

Tip

If the application needs to create the tracking target in a script instead of in the editor, you can record the tracking target and/or its child objects after placing them in the editor. At runtime, configure the tracking target through the script and mount the child objects under the tracking target.

Connect to the Service

Check the service information and connect to the service.

Important

You need to check the permissions of the API Key before connecting.

  • If the Type of the service is Block, ensure that the API Key used has permissions to access the Mega Block service and the SpatialMap service.
  • If the Type of the service is Landmark, ensure that the API Key has permissions to access the Mega Landmark service.

alt text

When the permissions are insufficient, you will see an error message indicating that the service connection verification has failed.

alt text

If the target data source has been correctly configured, you can see the data update time and the control interface for the block editor data after successfully connecting to the service.

Tip

If the target data source is left blank, you can see the list of block data in the service after successfully connecting to the service. After selecting the block you need to use, you can also enter the control interface for the block editor data, and the target data source will be automatically filled in.

Manage the Tool Data in the Scene

The data of the editor tool is stored under the EasyAR.Mega.EditorTool node. Deleting this node is equivalent to deleting the data of the editor tool.

Caution

Do not directly modify the content of the EasyAR.Mega.EditorTool node, especially do not modify the Transform of this node. Otherwise, it may cause the editor tool to fail to work properly or the content to be displayed in the wrong position during tracking.

Reload the Service Data

The block data displayed by the editor tool will not be automatically updated when the localization library data changes. After the localization library data is updated (for example, a block is added or deleted), click the Reload button to reload the service data.

Caution

If the original block in the localization library is overwritten with a block that uses the same block ID, the mesh and other content displayed by the editor tool will still be that of the original block before the data is updated. This may cause the real scene environment to be inconsistent with the updated one, affecting the accuracy of content placement.

If a block is deleted from the localization library, the editor tool can still obtain the block mesh and other data, but the application will no longer be able to track this block at runtime, which may cause errors in content display.

Next Steps