# Localization

[Localization](https://docs.multiset.ai/multiset-quest-sdk/sample-scenes/localization) scene demonstrates multi-frame map localization using the Quest SDK's `MapLocalizationManager`. This scene captures multiple camera frames to localize the device against a pre-existing 3D map or map set, providing higher accuracy compared to single-frame localization at the cost of slightly longer capture time.

This scene uses multiple camera frames (4–6) to localize against the map, ideal for situations where accuracy is prioritized over speed.

### Core Components

The scene includes the following key GameObjects:

* **MultisetSdkManager** — Handles SDK authentication and initialization.
* **MapLocalizationManager** — Manages the multi-frame localization process.
* **MapSpace** — Parent GameObject for all AR content anchored to the map.

### MapLocalizationManager Properties

<figure><img src="https://3163433004-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FokTDI7QVY04Zvb1pQ8Ry%2Fuploads%2FpWYVKBh55NgHSDVjHpdU%2FScreenshot%202026-03-31%20at%203.19.41%E2%80%AFPM.png?alt=media&#x26;token=ce886eee-72b7-41e0-94c9-ef73d65270fe" alt=""><figcaption></figcaption></figure>

| Property                        | Type               | Default | Description                                                                                                                                       |
| ------------------------------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `localizationType`              | `LocalizationType` | `Map`   | Select whether to localize against a single Map or a MapSet.                                                                                      |
| `mapOrMapsetCode`               | `string`           | `""`    | The unique code for the map or map set to localize against.                                                                                       |
| `autoLocalize`                  | `bool`             | `true`  | If true, localization starts automatically after SDK authentication.                                                                              |
| `backgroundLocalization`        | `bool`             | `true`  | When enabled, the manager periodically sends localization requests in the background to maintain positioning accuracy.                            |
| `bgLocalizationDuration`        | `float`            | `60`    | Time interval in seconds between background localization attempts. Valid range: **15–180 seconds**.                                               |
| `numberOfFrames`                | `int`              | `4`     | Number of camera frames to capture per localization request. More frames improve accuracy but increase capture time. Valid range: **4–6 frames**. |
| `frameCaptureInterval`          | `float`            | `0.3`   | Time delay in seconds between capturing each frame. Valid range: **0.4–0.8 seconds**.                                                             |
| `showAlert`                     | `bool`             | `true`  | If true, a toast message is displayed on success or failure.                                                                                      |
| `firstLocalizationUntilSuccess` | `bool`             | `true`  | When enabled, the first localization request retries silently until it succeeds without showing failure messages.                                 |

### Localization Callbacks

| Callback                | Description                                                                       |
| ----------------------- | --------------------------------------------------------------------------------- |
| `LocalizationInit`      | Invoked when the localization process is initiated by calling `LocalizeFrame()`.  |
| `LocalizationRequested` | Invoked just before captured frames are sent to the MultiSet API.                 |
| `LocalizationSuccess`   | Invoked when the device has been successfully localized and the pose is applied.  |
| `LocalizationFailure`   | Invoked when the localization process fails (e.g., no pose found, network error). |

### Public Methods

**LocalizeFrame()**

Manually starts the multi-frame localization process.

```csharp
public void LocalizeFrame()
```

Calling this method begins capturing the specified `numberOfFrames` from the Quest passthrough camera. Once the frames are collected, they are sent to the MultiSet backend to request localization. Use this if `autoLocalize` is disabled and you want to trigger localization manually.

### Setup

1. Open the **Localization** scene from the imported samples.
2. Select the **MultisetSdkManager** GameObject and configure your API credentials.
3. Select the **MapLocalizationManager** component and enter your **Map Code** or **MapSet Code**.
4. Adjust frame capture settings (`numberOfFrames`, `frameCaptureInterval`) based on your environment.
5. Build and deploy to your Meta Quest device.
