# Runtime

## Method Calls

* ScansInfoLoader.FetchAndWrapUserScansAsync
* ScansInfoLoader.FetchAndWrapPublicScansAsync
* ScanLoader.InstantiateScanAsync

## Events

* ScansInfoLoader.OnInfoLoaded  (user's scans)
* ScansInfoLoader.OnPublicInfoLoaded  (all public scans)
* ScansInfoLoader.OnInfoFailed
* ScanLoader.OnScanLoaded
* ScanLoader.OnScanFailed
* ScanLoader.OnScanDestroyed

## Getting Started

The easiest way to get started is to import the **Auto and Scan Import** sample into your Unity project. Go to `Windows > Package Manager > MeshMap Unity SDK > Samples`.

Make sure to [configure your app API key in the MeshMap Hub](https://docs.meshmap.com/unity-sdk/core/..#api-key).

#### Features

* A simple user flow for loading user scans and all public scans.
  * The player needs to be connected to their MeshMap account (see [Auth - Runtime](https://docs.meshmap.com/unity-sdk/core/auth/runtime)).
* Import any scan with a supported file type (.gltf/.glb) and load it to the active scene.
* Optionally, add a `NavMeshModifier` to the scan model and rebuild the `NavMeshSurface` in the scene.
* Destroy the previous scan from the scene when importing a new scan.

#### Components

<table><thead><tr><th width="226.00006103515625">Class</th><th>Description</th></tr></thead><tbody><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Runtime/API/Scans/ScansInfoLoader.cs"><code>ScansInfoLoader</code></a></td><td>Handles loading scan information asynchronously from the MeshMap Scans API.</td></tr><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Samples~/AuthAndScanImport/Scripts/Scans/ScanListingUI.cs"><code>ScanListingUI</code></a></td><td>Displays metadata for a single scan entry in the UI, including its name, location, and user information.</td></tr><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Samples~/AuthAndScanImport/Scripts/Scans/ScanLoader.cs"><code>ScanLoader</code></a></td><td>Demonstrates loading, instantiation, and cleanup of scan models in the active scene.</td></tr><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Samples~/AuthAndScanImport/Scripts/Scans/ScansUI.cs"><code>ScansUI</code></a></td><td>Demonstrates UI logic for listing, paginating, filtering, and loading scans from the MeshMap API. Provides controls to request user or public scans, validate pagination input, and display scan listings dynamically.</td></tr><tr><td><a href="https://github.com/MeshMap/com.meshmap.sdk.core/blob/main/Samples~/AuthAndScanImport/Scripts/Scans/NavMesh/BuildNavMeshAtRuntime.cs"><code>BuildNavMeshAtRuntime</code></a></td><td>Automatically builds or clears <code>NavMesh</code> data at runtime when a scan is loaded or destroyed.</td></tr></tbody></table>
