# mapbox/mapbox-unity-sdk architecture

> Architecture diagram of the GitHub repository mapbox/mapbox-unity-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mapbox/mapbox-unity-sdk
- Repository: https://github.com/mapbox/mapbox-unity-sdk

## Overview

The Mapbox Unity SDK provides interactive map rendering and also documents location, directions, and geocoding capabilities. In the visible map workflow, Unity initializes the map and its visualizer; loading a view computes tile coverage, loads the cover into memory, and displays a snapshot. Tile retrieval, rendering details, location integration, and API implementations are only partly represented in the excerpts, so uncertain connections are omitted or marked unverified.

Main entry points: [`Runtime/Mapbox/BaseModule/Map/MapboxMap.cs`](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapboxMap.cs) (Map lifecycle), [`Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs`](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs) (Cache manager), [`Runtime/Mapbox/BaseModule/Map/MapboxMapVisualizer.cs`](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapboxMapVisualizer.cs) (Tile visualizer), [`Runtime/Mapbox/BaseModule/Data/Tiles/Tile.cs`](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tiles/Tile.cs) (Tile lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_map["Map and tiles"]
  node_map["Map lifecycle<br/>[MapboxMap.cs]"]
  node_mapinfo["View settings<br/>[MapInformation.cs]"]
  node_service["Tile coverage<br/>[MapService.cs]"]
  node_visualizer["Tile visualizer"]
  node_tileids["Tile identifiers<br/>[CanonicalTileId.cs]"]
  node_tile["Tile lifecycle<br/>[Tile.cs]"]
end

subgraph group_data["Data and caching"]
  node_tiledata["Tile data<br/>[MapboxTileData.cs]"]
  node_fetch["Fetch queue"]
  node_cachemgr["Cache manager"]
  node_sqlite[("SQLite cache<br/>[SqliteCache.cs]")]
  node_cachetiles["Cached tile records<br/>[Tiles.cs]"]
  node_tasks["Task scheduler<br/>[TaskManager.cs]"]
end

subgraph group_unity["Unity runtime"]
  node_context["Unity context<br/>[UnityContext.cs]"]
  node_cachebehaviour["Cache setup"]
end

subgraph group_apis["Location and APIs"]
  node_location["Location services"]
  node_directions["Directions API<br/>[RoutingProfile.cs]"]
  node_geocoding["Geocoding"]
end

node_developer(("Unity developer"))
node_mapbox(("Mapbox services"))

node_developer -.->|"configures"| node_map
node_map -->|"initializes"| node_visualizer
node_map -->|"computes coverage"| node_service
node_map -->|"loads cover"| node_visualizer
node_map -.->|"reads view"| node_mapinfo
node_service -.->|"uses identifiers"| node_tileids
node_visualizer -.->|"loads tiles"| node_tile
node_tile -.->|"requests data"| node_tiledata
node_fetch -->|"initializes"| node_tile
node_fetch -.->|"requests tiles"| node_mapbox
node_cachebehaviour -->|"creates"| node_cachemgr
node_cachemgr -->|"reads and writes"| node_sqlite
node_cachemgr -->|"schedules work"| node_tasks
node_sqlite -.->|"stores records"| node_cachetiles
node_context -->|"initializes"| node_tasks
node_developer -.->|"uses GPS"| node_location
node_developer -.->|"requests routes"| node_directions
node_developer -.->|"geocodes places"| node_geocoding
node_directions -.->|"renders route"| node_map
node_location -.->|"centers map"| node_map
node_map -.->|"fetches map data"| node_mapbox

click node_map "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapboxMap.cs"
click node_mapinfo "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapInformation.cs"
click node_service "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapService.cs"
click node_visualizer "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapboxMapVisualizer.cs"
click node_tileids "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tiles/CanonicalTileId.cs"
click node_tile "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tiles/Tile.cs"
click node_tiledata "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/DataFetchers/MapboxTileData.cs"
click node_fetch "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/DataFetchers/DataFetchingManager.cs"
click node_cachemgr "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs"
click node_sqlite "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/SqliteCache.cs"
click node_cachetiles "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/Tiles.cs"
click node_tasks "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tasks/TaskManager.cs"
click node_context "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Unity/UnityContext.cs"
click node_cachebehaviour "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs"
click node_location "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/LocationModule/MapboxLocation/MapboxLocationServiceObserverProxy.cs"
click node_directions "https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/DirectionsApi/RoutingProfile.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_map,node_mapinfo,node_service,node_visualizer,node_tileids,node_tile toneBlue
class node_tiledata,node_fetch,node_cachemgr,node_sqlite,node_cachetiles,node_tasks toneAmber
class node_context,node_cachebehaviour toneMint
class node_location,node_directions,node_geocoding toneRose
class node_developer,node_mapbox toneIndigo
```

## Components

### Map and tiles

- [Map lifecycle](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapboxMap.cs): `Runtime/Mapbox/BaseModule/Map/MapboxMap.cs`
- [View settings](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapInformation.cs): `Runtime/Mapbox/BaseModule/Map/MapInformation.cs`
- [Tile coverage](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapService.cs): `Runtime/Mapbox/BaseModule/Map/MapService.cs`
- [Tile visualizer](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Map/MapboxMapVisualizer.cs): `Runtime/Mapbox/BaseModule/Map/MapboxMapVisualizer.cs`
- [Tile identifiers](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tiles/CanonicalTileId.cs): `Runtime/Mapbox/BaseModule/Data/Tiles/CanonicalTileId.cs`
- [Tile lifecycle](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tiles/Tile.cs): `Runtime/Mapbox/BaseModule/Data/Tiles/Tile.cs`

### Data and caching

- [Tile data](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/DataFetchers/MapboxTileData.cs): `Runtime/Mapbox/BaseModule/Data/DataFetchers/MapboxTileData.cs`
- [Fetch queue](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/DataFetchers/DataFetchingManager.cs): `Runtime/Mapbox/BaseModule/Data/DataFetchers/DataFetchingManager.cs`
- [Cache manager](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs): `Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs`
- [SQLite cache](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/SqliteCache.cs): `Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/SqliteCache.cs`
- [Cached tile records](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/Tiles.cs): `Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/Tiles.cs`
- [Task scheduler](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Data/Tasks/TaskManager.cs): `Runtime/Mapbox/BaseModule/Data/Tasks/TaskManager.cs`

### Unity runtime

- [Unity context](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Unity/UnityContext.cs): `Runtime/Mapbox/BaseModule/Unity/UnityContext.cs`
- [Cache setup](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs): `Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs`

### Location and APIs

- [Location services](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/LocationModule/MapboxLocation/MapboxLocationServiceObserverProxy.cs): `Runtime/Mapbox/LocationModule/MapboxLocation/MapboxLocationServiceObserverProxy.cs`
- [Directions API](https://github.com/mapbox/mapbox-unity-sdk/blob/main/Runtime/Mapbox/DirectionsApi/RoutingProfile.cs): `Runtime/Mapbox/DirectionsApi/RoutingProfile.cs`
- **Geocoding**

### Other components

- **Unity developer**
- **Mapbox services**

## Connections

- Unity developer → Map lifecycle: configures (evidence: `README.md`)
- Map lifecycle → Tile visualizer: initializes (evidence: `Runtime/Mapbox/BaseModule/Map/MapboxMap.cs`)
- Map lifecycle → Tile coverage: computes coverage (evidence: `Runtime/Mapbox/BaseModule/Map/MapboxMap.cs`)
- Map lifecycle → Tile visualizer: loads cover (evidence: `Runtime/Mapbox/BaseModule/Map/MapboxMap.cs`)
- Map lifecycle → View settings: reads view (evidence: `Runtime/Mapbox/BaseModule/Map/MapboxMap.cs`)
- Tile coverage → Tile identifiers: uses identifiers
- Tile visualizer → Tile lifecycle: loads tiles
- Tile lifecycle → Tile data: requests data
- Fetch queue → Tile lifecycle: initializes (evidence: `Runtime/Mapbox/BaseModule/Data/DataFetchers/DataFetchingManager.cs`)
- Fetch queue → Mapbox services: requests tiles
- Cache setup → Cache manager: creates (evidence: `Runtime/Mapbox/BaseModule/Unity/ModuleBehaviours/RuntimeCacheManagerBehaviour.cs`)
- Cache manager → SQLite cache: reads and writes (evidence: `Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs`)
- Cache manager → Task scheduler: schedules work (evidence: `Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs`)
- SQLite cache → Cached tile records: stores records (evidence: `Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/SqliteCache.cs`)
- Unity context → Task scheduler: initializes (evidence: `Runtime/Mapbox/BaseModule/Unity/UnityContext.cs`)
- Unity developer → Location services: uses GPS (evidence: `README.md`)
- Unity developer → Directions API: requests routes (evidence: `README.md`)
- Unity developer → Geocoding: geocodes places (evidence: `README.md`)
- Directions API → Map lifecycle: renders route (evidence: `README.md`)
- Location services → Map lifecycle: centers map (evidence: `README.md`)
- Map lifecycle → Mapbox services: fetches map data (evidence: `README.md`)
