Table of Contents

Create and upload annotations using the Unity editor

This article introduces how to create and upload annotations using Mega Studio in the Unity editor.

Before you begin

Tip

The Mega plugin has added dependencies for com.unity.cloud.gltfast, so you can directly drag model files 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

Local coordinate system of annotations in Unity environment: Positive X-direction points backward, positive Y-direction points upward, positive Z-direction points right.

xr-frame

Local coordinate system of annotations in xr-frame environment: Positive X-direction points backward, positive Y-direction points upward, positive Z-direction points left.

These directional differences stem from the different coordinate system definitions (left-hand/right-hand rules) used by Unity and xr-frame.

Using EMA to synchronize spatial positions offers significant advantages:

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

Steps

  1. Create annotation tool

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

    annotation

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

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

    annotation

  2. Log in to account

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

  3. Select Mega cloud localization library

    Click the icon on 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.

    annotation

  4. Load Block dense model

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

    annotation

    The loaded model appears in the Scene tab. Note: When the indicator shown below appears at the bottom-left, models within the current view haven't finished loading. Wait until it disappears to confirm completion.

    annotation

  5. Create annotation

    Hold Ctrl (Windows) / Command (Mac) in the scene, then left-click where annotation is needed.

  6. Use models

    Drag imported models into the scene node as child nodes of the annotation.

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

    Note

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

    annotation

  7. [Optional] Precise model position adjustment

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

  8. Create new annotation data package

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

    annotation

    Enter the annotation data name in the box and click the checkmark on the right.

    annotation

    Upon successful creation, it should appear as shown. Then click Confirm below.

    annotation

    Click the upload icon to upload.

    annotation

    A success prompt appears after upload.

    annotation

  9. Record annotation ID

    Record the annotation data name or ID to load corresponding data on xr-frame.

    annotation

    After successful upload, corresponding information appears in the cloud localization library.

    annotation

    View uploaded annotation data names and IDs here.

    annotation

Next steps