Introduction to the HMD extension package template
The com.easyar.sense.ext.hmdtemplate package provides examples and templates for HMD extension development. It is an implementation of the SDK and includes samples for application developers.
Template content
The package structure of this package follows the Unity recommended file layout:
.
├── CHANGELOG.md
├── Documentation~
├── Editor
├── LICENSE.md
├── package.json
├── Runtime
└── Samples~
└── Combination_BasedOn_HMD
Some of the more important contents are as follows:
- Runtime: The folder containing runtime platform assets. This is the most important folder in the template.
- Samples~: The folder containing all samples in the package. It includes examples for downstream use and can serve as a demo for testing extensions. To develop this sample in place, the folder name needs to be changed to
Samples. Using the Client.Pack method will automatically rename it toSamples~when packing a new release. - Editor: The folder containing editor platform assets. The scripts in this folder are mainly used to create menu items.
- package.json: The manifest file of the package.
Creation process of the template example
-
In the
Hierarchyview:- Right-click in an empty area, and add ARSession via the menu
EasyAR Sense>Mega>AR Session (Mega Block Default Preset). - Select AR Session (EasyAR) and right-click, then add an ImageTrackerFrameFilter to the session via the menu
EasyAR Sense>Image Tracking>Frame Filter : Image Tracker. - Select AR Session (EasyAR) and right-click, then add an DenseSpatialMapBuilderFrameFilter to the session via the menu
EasyAR Sense>SpatialMap>Frame Filter : Dense SpatialMap Builder. - Select AR Session (EasyAR) and right-click, then add an SparseSpatialMapBuilderFrameFilter to the session via the menu
EasyAR Sense>SpatialMap>Frame Filter : Sparse SpatialMap Builder. - Select AR Session (EasyAR) and right-click, then add and keep only the HMD Template FrameSource via the menu
EasyAR Sense>Extensions>Frame Source : HMD Template (keep it only).

- Right-click in an empty area, and add ARSession via the menu
-
In the
Hierarchyview, right-click in an empty area, and add an ImageTargetController to the session via the menuEasyAR Sense>Image Tracking>Target : Image Target.Configure ImageTargetController:

After completing the above configuration, the image displayed in the
Sceneview is a gizmo. In this example, a quad is used to display the virtual object of the same image.Add a virtual object to display on the target:

Add a model as a reference for motion tracking origin
This model is important for both developers and downstream users, as it is used to decouple device motion tracking from EasyAR algorithms.

Add UI for feature selection

Disable EasyAR features at startup and enable them via UI switches
For example, the image tracking feature can be disabled at startup by setting the corresponding component's enable to false:

Then add UI switch handling:

Related topics
- Enable headset support for EasyAR introduces how to use this template to create a new headset extension package
- Run verification (bring-up) introduces how to use the examples provided by this template to verify the correctness of the input extension
- Publish extension package introduces how to complete the final packaging and distribution based on this template