How to Migrate to EasyAR 1.3

EasyAR 1.3 has a few interface changes. You may need to do some changes to migrate your app to EasyAR 1.3 from older versions.

Unity

First, it is suggested to remove all files under Assets/EasyAR and copy/import them from the new unity package or samples. If you have modified files inside this folder, make sure to back up first, and re- apply your changes after import. Generally, it is suggested not to change any file inside this folder and only inherit from them, which will make later upgrade easier.

Prefabs

EasyAR now has many more prefabs than before. Primitives are some prefabs that are able to combine together. And Composites are some samples that can be used directly.

For example, EasyAR_ImageTracker-1_Barcode-1 is the old EasyAR prefab + 1 ImageTracker + 1 BarcodeScanner.

Previous EasyAR prefab has been renamed to EasyAR_Startup. It is same as EasyAR_ImageTracker-1. That is EasyAR + 1 ImageTracker.

ImageTracker prefab and BarCodeScanner prefab can be put into the scene and the ARBuilder script will link things up automatically. You can also change the callings to manually start those functions.

Work Flow

The whole work flow and buildup process has changed. But if you are not digging very deep into the scripts, you may not see much difference.

BarcodeScanner now has the same work flow as ImageTracker. And there will be further more things like them, the CloudRecognizer, for example.

If you are building EasyAR manually, you need to bind things up. unbind has been removed and replaced by bind(null). When a object bind to another object, the previously bound objects will automatically unbind and remove themselves from each other. For example, when ImageTargetBaseBehoviour bind to a ImageTrackerBaseBehaviour, if the target has been loaded into other trackers, it will be unload first, then if the tracker has started, it will load into the tracker immediately, otherwise it will be loaded into the tracker after the tracker start.

Target and Tracker

You need to specify a tracker for the target on the inspector now. Previously only load target in the script will need a tracker, now you also need to do that in the editor. A default tracker will be selected if a new ImageTarget prefab is dragged into the scene if there is an active tracker. For more infomation, please reference the article about EasyAR Multi-Target.

When doing this dynamically, you may need to call ImageTargetBaseBehaviour.Bind. The behaviour of Bind has changed a lot in 1.3. It is not only a static buildup method, but also a dynamic method in replace of LoadIntoTrackerBehaviour(before 1.3), and Bind(null) is a replace for UnloadFromAllTrackers(before 1.3).

Target Events

ITargetEventHandler has been removed from the code. And event center is at AugmenterBaseBehaviour. Many events will be triggered when a new frame is get from AugmenterBaseBehaviour.

Now the ImageTrackerBaseBehaviour has its own events for load/unload/found/lost.

Global event handler can use load/unload events from each ImageTrackerBaseBehaviour, and found/lost events from AugmenterBaseBehaviour.

QRCode found event has been moved to AugmenterBaseBehaviour.

For how to use the new events, you can reference samples or this.

New Features

There are a few new features in 1.3, you can reference individual API docs for the new features.

  • multi-target tracking

  • flip camera input horizontally

  • show/hide RealityPlane (camera image)

  • open camera with index

  • change pose at FrameUpdate

Native

Native side changes are not that big compared to Unity side. Some headers has been renamed and it is suggested to remove all header files and copy/import them from the new package or samples.

Work Flow

The whole work flow and buildup process has changed.

Augmenter now needs to attach to a camera first before it can get new frames.

Augmenter.newFrame interface changed, now input parameter required now.

Augmenter.drawVideoBackground no longer changes the caller's view port, so now you need to manage both your viewport and Augmenter viewport.

Augmenter.drawVideoBackground can draw directly onto a texture if setVideoBackgroundTextureID is called with valid texture id.

New Features

There are a few new features in 1.3, you can reference individual API docs for the new features.

  • multi-target tracking

  • flip camera input horizontally