Skip to main content

Import Map Contents

This tutorial will guide you on how to download the map contents of a map assigned to your app, and import it to your Unity project. First, make sure that you have followed the previous guide on Placing Map Contents before going through this guide.

Download Map Contents

You can download them from the Unity Editor by selecting the option Pretia > Map Download. This will open the Map Download window and if you press the Reload groups button, then it will show all the maps that is used within your application, grouped by their map group. Press the Download Map Contents button to download the map contents of the map for this application.

You can have different map contents for the same map assigned to a different App Key.

Downloading the map contents will create a new directory on this path. Assets/Pretia/MapGroups/{mapGroupName}/{mapName}/MapContents.

Inside the directory, you will find a json file which is the representation of your map contents, and a prefab generated from this json file. You can drag this prefab to the hierarchy.

This is how it will look like in the Unity Editor. Each of the game objects in this generated prefab contains MapContentComponent to help the SDK identify each of the objects. Please make sure to not modify them.

In the case that these values are modified by accident, you can always right click on the json file and select Create > Pretia ArCloud > Prefab from Map Contents to regenerate the prefab.

At this point you can add your custom scripts to the generated object from the map contents, however instead of adding it directly, we recommend creating a Prefab Variant of the generated prefab. The reason is that throughout the development lifecycle of your app, the map contents would most likely be updated. When the new map content is imported, it will regenerate the prefab. In order to prevent any losses in your progress, we recommend leaving the generated prefab alone and add your custom scripts to the prefab variant.

As long as you don't modify the transform of the objects in your prefab variant, it will be updated correctly whenever the map content is updated.

Tip: We recommend creating the prefab variant by dragging it from the hierarchy to the project tab. Creating it by right-clicking and selecting Create > Prefab Variant seems to reset the transform of the root object which is not desireable.

Using the Map Contents

Build your app with the map contents in the scene and use map-based relocalization to verify whether the placement of the map contents are accurate.