1. Home
  2. Docs
  3. Unity SDK
  4. Concepts and Architecture
  5. Features
  6. Maps

Maps

Motive can render 2D and 3D maps in Unity. There are a number of pieces to Motive’s map solution:

Map Visualizer

This is the code that renders the actual map. Motive has a “MapTexture” class that renders raster tiles into a Unity Texture from any map tile source. Motive also supports other rendering solutions such as Mapbox and Go Maps to display maps. It should be fairly straightforward to render any tile-based map source using Motive using Motive’s Mapbox render, MapViewWrapper, as a guide.

Map View

The Map View allows you to display content, particularly annotations, on the Map Visualizer. It handles the lifecycle of annotations and other markers that are not currently visible on the map.

Map Controller

The Map Controller is the primary “doer” of the map solution for the rest of the app. All calls to add/remove annotations and change the visualization of the map (pan, zoom, etc.) should go through the Map Controller. The Map Controller instance can be overridden with your own implementation without having to re-write all of the calling code.

Map Annotation Handlers

Map annotations come in many shapes and sizes. Each type of annotation is handled by its own annotation handler. A few examples:

  • Marker annotation handler – handles annotations from the Location Marker resource.
  • Task annotation handlers – handles annotations used by Location and AR tasks.
  • Locative audio annotation handler – handles annotations that can visualize 2D and 3D locative audio

Map Annotations

Map annotations have two parts: the MapAnnotation itself (which implements IAnnotation), and the AnnotationGameObject which is actually rendered on the map. The AnnotationGameObject is not guaranteed to be shown at all times–for example the MapView may recycle annotations that are no longer visible or the app may switch to a mode that only shows a subset of annotations. The Map Annotation Handlers implement methods that can create and recycle annotations. (By default, the annotation handlers simply destroy recycled objects, but an app that makes heavy use of annotations and is often creating/destroying could implement a more efficient solution.)

There is a generic version of MapAnnotation that takes a data object. Take a look at LocationTaskAnnotationHandler for an example of a generic MapAnnotation (MapAnnotation<LocationTaskDriver>).

Selected Location Panels

At any given time there may be one “selected” annotation. In most cases, the selected annotation displays information in a “selected location panel”. The default map annotation handler implementation displays the location information in a panel. The default selected location panel implementation shows the location name and the distance to the location, but can easily be extended to show any other information relevant to the location.

Was this article helpful to you? Yes No

How can we help?