Add Mega Go Tracking Target
This article describes how to add and configure a Mega Go tracking target.
Before You Start
- Check Is My Localization Function Available? to confirm that the correct map has been downloaded.
- Import the latest version of the EasyAR plugin and enable the Mega Go function
- Understand the basic concepts and usage methods of Unity AR tracking targets
Note
The following content and tools are only applicable to the process of developing Unity applications using EasyAR Mega Go. The plugin version >= 4003.1 is required.
Mega Go does not support mini-program development.
The content of this article requires the following Unity packages to have been imported into the project:
com.easyar.sense
Mega Go Tracking Target
A Mega Go tracking target is an empty object containing the MegaGoBlockController component, which represents a block in Unity.

Note
When the com.easyar.mega package is not imported, the editor functions of the block are unavailable, but this does not affect the tracking effect and functions at runtime.
Create a Tracking Target
Right-click on the blank area in the Hierarchy view. You can create a Mega tracking target through the menu EasyAR Sense > Mega > Target : Mega Go Block.

In the script, you can use ARSessionFactory.CreateController to create it.
ARSessionFactory.CreateController<MegaGoBlockController>();
Configure the Tracking Target
Before using a target, you need to configure its data source and tracker.
Configure the Target Data Source
A tracking target can only be recognized and tracked after its source is correctly configured.
In the Hierarchy view, you can select the block node and then fill in the block's Path Type and Path.

In the script, you can modify Source to set the block's source before the component MonoBehaviour.Start().
block.Source = new MegaGoBlockController.FileSourceData(PathType.Absolute, path);
Among them:
- PathType is the type of the emg file path, which can be an absolute path (
Absolute) or the StreamingAssets path of the project (StreamingAssets). - Path is the path of the emg file. When PathType is
Absolute, it is the absolute path in the file system. When PathType isStreamingAssets, it is the relative path under the StreamingAssets folder in the project.
Tip
Since the emg file may be large, if the application package size is too large, it is recommended to use the StreamingAssets path only during the testing phase. When officially releasing, use an absolute path and place the emg file in a file system path accessible to the application through a resource package or other means.
Configure the Tracker Used by the Target
The tracking target will be loaded and tracked by the configured tracker.
Important
The Mega Go tracker can only track one block at a time. If multiple blocks are configured in the same tracker at the same time, only the last loaded block will be used.
In the Hierarchy view, you can select the block node and then select the Mega Go Tracker in the session.
![]()
In the script, you can modify Tracker to set the tracker for the block.
block.Tracker = megaGoTracker;
Tracker can be modified at any time during runtime. Loading/unloading will occur when the session is running. If Tracker is set to null, the target will be unloaded from the previously set tracker.
Note
There are several key conditions for a target to be tracked:
- The block corresponding to the Source must be in an available state (formal data is always available offline, and test data is only available when the data exists in the service).
- The file of MegaGoBlockController.Source must be correctly loaded.
- No other files corresponding to blocks are loaded after the file is loaded.
Lifecycle of the Tracking Target
A common lifecycle of a tracking target is as follows:
flowchart LR
sstart((session start))
sstop([session stop])
start("Target.Start")
load("Load")
tracking[["Continuous Tracking"]]
sstart --> load --> tracking --> sstop
start -. "Target.Tracker = tracker" .-> load
The process is roughly divided into several stages:
- Loading: The tracking target is loaded by the configured tracker, which occurs after the target's own Start() and the session is started.
- Tracking process: After the tracking target is located, the tracker will continuously track the target's position and status until the target is unloaded or another target is loaded.
- Unloading: The tracking target is unloaded from the tracker, and the tracker will no longer track the target. This occurs when the session stops or the target is set to not use the tracker.
