Table of Contents

Create and upload annotations with Unity Editor

This article introduces how to create and upload annotations with Mega Studio in Unity Editor.

Before you begin

Tip

The Mega plugin already adds a dependency on com.unity.cloud.gltfast, so you can directly drag the model file into Unity Assets.

Why annotations are needed

EasyAR Mega Annotation (EMA) can be used to synchronize spatial positions across platforms with different coordinate system definitions.

Unity

The local coordinate system of an annotation in the Unity environment: the positive X direction points backward, the positive Y direction points upward, and the positive Z direction points right.

xr-frame

The local coordinate system of an annotation in the xr-frame environment: the positive X direction points backward, the positive Y direction points upward, and the positive Z direction points left.

The above direction difference comes from the different coordinate system definitions used by Unity and xr-frame (left-handed/right-handed systems).

Using EMA to synchronize spatial positions has the following significant advantages:

  1. Simplified development process: automatically handles cross-platform coordinate conversion, avoiding the cumbersome logic and error-prone nature of manual calculation.
  2. Improved debugging efficiency: it can be loaded directly in MegaToolbox, making real-device testing and data verification faster.

Operation steps

  1. Create annotation tool

    Right-click in Unity's Hierarchy panel, then select EasyAR Mega > Tool > Annotation Tool (Edit Mode) in sequence.

    annotation

    After creation is complete, two nodes, EasyAR.Mega.Annotation and MegaBlocks, are generated in the scene.

    Select the EasyAR.Mega.Annotation node. Username/email and password input boxes will appear in its Inspector panel.

    annotation

  2. Log in to account

    Enter the EasyAR account and password, then click login. If successful, the Studio tool will appear in the Inspector panel.

  3. Select Mega cloud localization database

    Click the icon on the right side of Mega Cloud Service.

    annotation

    Select the database to use.

    annotation

    After the localization database and Mega Blocks information are loaded successfully, the Studio tool panel is shown as follows.

    annotation

  4. Load Block dense model

    Click Load on the right side of the Block name to dynamically load the dense model of that Block.

    annotation

    After the model finishes loading, it appears in the Scene tab. Note that when the indicator shown in the lower-left corner appears, the model in the current view has not finished loading. Wait a moment until the indicator disappears, which means loading is complete.

    annotation

  5. Create annotation

    In the scene, hold Ctrl (Windows) / Command (Mac), then left-click the location where an annotation is needed.

  6. Use model

    Drag the imported model to the scene node as a child node of the annotation.

    Set all Position and Rotation values in the model's Inspector panel to 0. Scale can be adjusted as needed.

    Note

    EMA carries all coordinate transformation logic. Setting the model Position and Rotation to 0 makes the model's geometric center exactly coincide with the annotation point. All translation and rotation adjustments should be completed by operating its parent node, the annotation node.

    annotation

  7. [Optional] Precisely adjust model position

    If you need to precisely adjust the model position and orientation, see how to use the Unity editor to precisely align 3D content with the real scene.

  8. Create annotation data package

    Click the icon on the right side of the annotation data package in the Inspector panel.

    annotation

    Enter the name of the annotation data in the box, then click the check mark on the right.

    annotation

    After creation succeeds, it should look as shown. Then click Confirm below.

    annotation

    Click the upload icon to upload.

    annotation

    A prompt appears after upload succeeds.

    annotation

  9. Record annotation ID

    You need to record the name or ID of the annotation data to load the corresponding annotation data in xr-frame.

    annotation

    After upload succeeds, you can also see the corresponding information in the cloud localization database.

    annotation

    You can also view the uploaded annotation data name and ID here.

    annotation

Next steps