> ## 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 vision model fully on-device inside a Unity XR app on Meta Quest 3 / 3S

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

This example brings Edge Impulse on-device inference into an immersive **Unity XR** app for the **Meta Quest 3 / 3S** — a headset that runs Android. A virtual conveyor belt carries bottles past an inspection station; an Edge Impulse **FOMO object-detection** model checks each bottle's cap, and a reject arm shoves the failures off the belt so they smash on the floor — all running locally on the headset, with no network connection.

Because the Quest runs Android, the same Edge Impulse **C++ library** you would deploy to a phone is compiled to a native plugin and called from Unity through a small P/Invoke bridge — the [Android series](/tutorials/topics/android/android-series) NDK approach, wrapped for the Unity engine.

![The conveyor inspection demo](https://raw.githubusercontent.com/edgeimpulse/Unity-ARXR-Factory-Floor-Example/main/docs/media/factory-demo.gif)

<CardGroup cols={2}>
  <Card title="Example repository" icon="github" href="https://github.com/edgeimpulse/Unity-ARXR-Factory-Floor-Example">
    Unity project, native plugin sources and a prebuilt APK.
  </Card>

  <Card title="Public Edge Impulse project" icon="cube" href="https://studio.edgeimpulse.com/public/751472/live">
    Clone the bottle-cap FOMO model into your own account.
  </Card>
</CardGroup>

## What you'll learn

* How to run an Edge Impulse **FOMO** model on-device from **Unity** through a native plugin (no cloud calls).
* How the same Android C++ SDK deployment powers a Meta Quest XR experience.
* How to feed pixels from a Unity camera into 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, hands the pixels to the Edge Impulse model, and reacts to the result.

<Steps>
  <Step title="Deploy the model as a C++ library">
    In Edge Impulse Studio, go to **Deployment → C++ library** and build. A thin wrapper (`native/ei_fomo.cpp`) exposes a `classify` entry point.
  </Step>

  <Step title="Compile a native plugin per platform">
    Build the wrapper to `libei_fomo.so` (Android `arm64-v8a`, for the Quest) and `libei_fomo.dylib` (macOS, for the Editor). Prebuilt libraries are committed in the repository.
  </Step>

  <Step title="Run inference from Unity">
    `EdgeImpulseFOMO.cs` P/Invokes the plugin; the inspection station classifies each bottle's cap and flags `cap_incorrect` as a defect.
  </Step>

  <Step title="React in the scene">
    Defective bottles are pushed off the conveyor by a reject arm and shatter on impact, while `cap_correct` bottles pass through.
  </Step>
</Steps>

## Requirements

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

## 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 / 3S (or an arm64 Android device):

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

Or open the project in Unity, open `Assets/Scenes/FactoryFloorDemo.unity`, and press **Play** to run it in the XR Device Simulator. A single `FactoryDemo Bootstrap` object builds the whole scene — conveyor, inspection station, reject arm and HUD — in code, so it is easy to read and adapt.

<Tip>
  The experience is designed to be hardware-agnostic: the same Android build runs on a Quest headset for room-scale XR, and the project can be built for a phone or the browser — handy for classroom demos, teaching, and events.
</Tip>

## Related

<CardGroup cols={2}>
  <Card title="Android series" icon="android" href="/tutorials/topics/android/android-series">
    The NDK + C++ SDK deployment path this example builds on.
  </Card>

  <Card title="ExecuTorch" icon="fire" href="/tutorials/integrations/executorch">
    Deploy PyTorch models to Android with ExecuTorch and Edge Impulse.
  </Card>
</CardGroup>
