> ## Documentation Index
> Fetch the complete documentation index at: https://docs.edgeimpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AR/XR factory floor (Unity + Meta Quest 3)

> Run an Edge Impulse FOMO model on-device inside a Unity XR app on Meta Quest 3 or 3S.

This example runs Edge Impulse inference inside a Unity XR app on Meta Quest 3 or 3S. A virtual conveyor carries bottles past an inspection station, where a FOMO object detection model checks each bottle's cap. A reject arm pushes the bottles with a bad cap off the belt. Everything runs on the headset, with no network connection.

The Quest runs Android, so the example uses the same Edge Impulse C++ library you would deploy to a phone, compiled as a native plugin and called from Unity through P/Invoke. It's the [Android series](https://docs.edgeimpulse.com/tutorials/topics/android/android-series.md) NDK approach, wrapped for Unity.

![Bottles moving along a virtual conveyor past an inspection station, where a reject arm pushes a bottle with a bad cap off the belt](https://raw.githubusercontent.com/edgeimpulse/Unity-ARXR-Factory-Floor-Example/main/docs/media/factory-demo.gif)

> [card] [Example repository](https://github.com/edgeimpulse/Unity-ARXR-Factory-Floor-Example)
>
> Unity project, native plugin sources, and a prebuilt APK.

> [card] [Public Edge Impulse project](https://studio.edgeimpulse.com/public/751472/live)
>
> Clone the bottle cap FOMO model into your own account.

## What you'll learn

* How to run a FOMO model on-device from Unity through a native plugin
* How to use an Android C++ library deployment in a Meta Quest XR app
* How to pass pixels from a Unity camera to the model and act on the result in the scene

## How it works

A virtual inspection camera in Unity renders the bottle at the inspection point, passes the pixels to the model, and reacts to the result.

**1. Deploy the model as a C++ library**

In Edge Impulse Studio, go to **Deployment**, select **C++ library**, and build. A wrapper in `native/ei_fomo.cpp` exposes a `classify` function.

**2. Compile a native plugin for each platform**

Build the wrapper as `libei_fomo.so` (Android `arm64-v8a`, for the Quest) and `libei_fomo.dylib` (macOS, for the Unity Editor). The repository includes prebuilt copies of both.

**3. Run inference from Unity**

`EdgeImpulseFOMO.cs` calls the plugin through P/Invoke. The inspection station classifies each bottle's cap and treats `cap_incorrect` as a defect.

**4. React in the scene**

The reject arm pushes defective bottles off the conveyor, and `cap_correct` bottles pass through.

## Requirements

* Unity 6000.0.32f1
* A Meta Quest 3 or 3S in developer mode, or an arm64 Android device
* URP, XR Interaction Toolkit, OpenXR, and XR Hands (already included in the project)
* Android NDK r23b, to rebuild the native library with your own model

## Quick start

Download the latest APK from the repository's [Releases](https://github.com/edgeimpulse/Unity-ARXR-Factory-Floor-Example/releases) page and sideload it onto a Quest 3 or 3S, or an arm64 Android device:

```bash theme={"system"}
adb install -r FactoryFloorXR-latest.apk
```

To run it in the XR Device Simulator instead, open the project in Unity, open `Assets/Scenes/FactoryFloorDemo.unity`, and press **Play**. One `FactoryDemo Bootstrap` object builds the whole scene in code, including the conveyor, inspection station, reject arm, and HUD, so you can read and adapt it in one place.

## Related

> [card] [Android series](https://docs.edgeimpulse.com/tutorials/topics/android/android-series.md)
>
> The NDK and C++ SDK deployment path this example builds on.

> [card] [ExecuTorch](https://docs.edgeimpulse.com/tutorials/integrations/executorch.md)
>
> Deploy PyTorch models to Android with ExecuTorch and Edge Impulse.
