Table of Contents

Create and Upload Annotations Using the Unity Editor

This article explains how to create and upload annotations using Mega Studio in the Unity Editor.

Before you begin

Tip

The Mega plugin has already added 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 annotations in the Unity environment: The positive X-direction points backward, the positive Y-direction points upward, and the positive Z-direction points to the right.

xr-frame

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

The above directional differences arise from the different coordinate system definitions (left-handed/right-handed) used by Unity and xr-frame.

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

  1. Simplifies the development process: Automatically handles cross-platform coordinate conversions, avoiding the cumbersome logic and error-proneness of manual calculations.
  2. Improves debugging efficiency: Can be directly loaded on MegaToolbox, facilitating quick real-device testing and data validation.

Steps

  1. Create annotation tool

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

    annotation

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

    Select the EasyAR.Mega.Annotation node, and its Inspector panel will display input fields for username/email and password.

    annotation

  2. Log in to account

    Enter your EasyAR account and password, then click login. Upon success, the Studio tool will appear in the Inspector panel.

  3. Select Mega cloud localization library

    Click the icon to the right of Mega Cloud Service.

    annotation

    Select the library to use.

    annotation

    After successfully loading the localization library and Mega Blocks information, the Studio tool panel appears as shown below.

    annotation

  4. Load block dense model

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

    annotation

    The model appears in the Scene tab after loading. Note: When the indicator shown below appears in the lower-left corner, the model within the current view is not fully loaded. Wait until this indicator disappears to confirm loading is complete.

    annotation

  5. Create annotation

    Hold down Ctrl (Windows) / Command (Mac) in the scene, then left-click where you want to annotate.

  6. Use model

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

    Set the model's Position and Rotation values to 0 in the Inspector panel. Adjust Scale as needed.

    Note

    EMA handles all coordinate conversion logic. Setting the model's Position and Rotation to 0 ensures the model's geometric center aligns perfectly with the annotation point. All position and rotation adjustments should be made by manipulating its parent node (the annotation node).

    annotation

  7. [Optional] Precise model position adjustment

    For precise adjustment of model position and orientation, refer to How to use Unity editor to precisely align 3D content with real world.

  8. Create new annotation data package

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

    annotation

    Enter a name for the annotation data in the field and click the checkmark on the right.

    annotation

    After successful creation, it should appear as shown below. Click Confirm.

    annotation

    Click the upload icon to upload.

    annotation

    A success prompt appears after uploading.

    annotation

  9. Record annotation ID

    You need to record the annotation data's name or ID to load the corresponding annotation data on xr-frame.

    annotation

    After successful upload, you can also see the corresponding information in your cloud localization library.

    annotation

    The uploaded annotation data name and ID can also be viewed here.

    annotation

Next steps