Skip to main content

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 NDK approach, wrapped for the Unity engine. The conveyor inspection demo

Example repository

Unity project, native plugin sources and a prebuilt APK.

Public Edge Impulse project

Clone the bottle-cap FOMO model into your own account.

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.
1

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.
2

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.
3

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.
4

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.

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 page and sideload it onto a Quest 3 / 3S (or an arm64 Android device):
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.
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.

Android series

The NDK + C++ SDK deployment path this example builds on.

ExecuTorch

Deploy PyTorch models to Android with ExecuTorch and Edge Impulse.