Microtube Docs
Developers / Guides / Unity integration

Unity integration

Install the HEXR package, choose an XR backend, and set up a scene that fires haptics.

Install the package

HEXR ships as a Unity package called com.microtube.hexr. It works in any Unity 2022.3 or newer project. You also need git installed and on your PATH, because Unity calls out to git to fetch the package.

Add by URL, not by name

The package is not published to a registry, so Add package by name fails with “Unable to find package”. com.microtube.hexr identifies the package; it is not somewhere Unity can fetch it from. Use the git URL below.

  1. Open Package Manager

    In Unity, go to Window → Package Manager.

  2. Add the package from its git URL

    Click the + button in the top-left corner and choose Add package from git URL…. Paste the URL below, then click Add.

shell
https://github.com/MicrotubeTechnologies/com.microtube.hexr.git

Prefer to edit the manifest by hand? Add this line to the dependencies block of Packages/manifest.json instead:

json
"com.microtube.hexr": "https://github.com/MicrotubeTechnologies/com.microtube.hexr.git"

The URL carries no version, so it installs the latest release — main is kept releasable. Add a tag (#v0.4.0) when a build has to stay reproducible. Either way, UPM caches a git dependency by the ref it resolved, so an unpinned URL does not re-check on its own: pull a newer one with Window → Package Manager → com.microtube.hexr → Update. The HaptGlove runtime and its Bluetooth transports for Windows, Android and macOS are bundled, so there is nothing else to source.

Conflicts

If your project already carries its own HaptGlove.dll or ArduinoBluetoothAPI* binaries under Assets/Plugins/, delete them first. Two copies of the same assembly is a hard compile error, not a warning.

Pick an XR backend

The package depends on neither XR backend, so it compiles in a project with no XR at all — and nothing installs one for you. Open HexR → HexR Tools → Project Setup, choose the backend your project targets, and install whatever it reports missing.

BackendBest forGetting it
OpenXRCross-vendor Quest / PicoEvery package comes from Unity's own registry — the installer handles it
Meta OVRMeta Quest 2 / 3 / 3SThe Meta XR SDK is not on Unity's registry — see below

Getting the Meta XR SDK

Unity's package registry does not carry com.meta.xr.sdk.*, so Package Manager cannot fetch it by name until the SDK is attached to your Unity account. That is a one-time, free step:

  1. Add it to your Unity account

    Open the Meta XR All-in-One SDK on the Asset Store and click Add to My Assets. It is free.

  2. Install it into the project

    In Unity, go to Window → Package Manager, switch the dropdown to My Assets, find Meta XR All-in-One SDK and click Install.

  3. Re-scan

    Back in HexR → HexR Tools → Project Setup, press Re-scan. Meta OVR should now show as detected.

Project Setup links straight to both pages when it sees the SDK missing, so you do not have to go hunting.

Want a scene that already works instead? Each tutorial project ships the package plus a demo scene: OpenXR ↗, Meta OVR ↗ or MRTK ↗.

Set up the scene

In a hurry? Run HexR → Create Demo Scene. It builds a fresh scene with the rig, both Pressure Controllers, a grabbable cube and a haptic zone — and a wired ProximityCheck, so haptics actually fire. You still add your own hand-tracking rig at the end; the console tells you how. The steps below are the same thing done by hand.

  1. Add a hand-tracking rig to your scene

    HEXR follows a hand-tracking rig that is already in the scene; it does not create one. Use Meta Building Blocks' Hand Tracking block, or an OpenXR rig with com.unity.xr.hands.

  2. HexR → Create HexR Rig → your backend

    Instantiates the HexR Main rig and the Pressure Controllers. Those are not optional — every haptic trigger looks up a Pressure Controller in the scene and produces nothing without one.

  3. HexR → Auto Setup Scene

    Wires the hand roots, the fingertip and palm colliders, and the Pressure Controllers to each other. Same as the Auto Set Up HexR button on the HexRManager inspector.

  4. HexR → Validate Scene Setup

    Reports anything still unwired. Run it before you press Play — it catches the mistakes that otherwise look like broken hardware.

  5. Pair the glove

    Power on the arm module, then connect from the in-scene HexR Panel, or call ConnectLeftBT() / ConnectRightBT() yourself. See Calibration & fit.

Make objects feel touchable

Haptics only fire while HEXR believes a hand is near the object. The two backends do not feed that check equally:

SignalMeta OVROpenXR
Grab interactor hoveringYes
Poke interactor hoveringYes
ProximityCheck trigger volumeYesYes — the only source
On OpenXR, ProximityCheck is mandatory

A scene with no ProximityCheck fires no haptics at all, and it looks exactly like a dead glove. Put one with a trigger collider on each object the hand should be able to feel, then press its Auto Set Up button to wire both Pressure Controllers. On Meta OVR it is optional — the grab and poke interactors already supply the signal.

The components you will use

Two groups, and it is worth keeping them straight: some live once in the scene and run the glove, the rest go on the objects you want to feel.

Scene-level — added once

ComponentWhat it does
HexRManagerThe scene's controller, reachable anywhere through HexRManager.Instance. Owns the connection flow — ConnectLeftBT() and ConnectRightBT() — plus which XR backend this scene targets and the size of the generated touch colliders
HaptGloveHandlerOne per hand: the actual Bluetooth device. BTConnection() opens the link, GetBatteryLevel() and GetAirPressure() read back from the glove. HexRManager.leftHand and .rightHand point at these
PressureTrackerMainThe per-hand haptics controller, one on each Pressure Controller. Call it directly when you want full control instead of firing from physics
HapticFingerTriggerSits on every fingertip and palm collider of the rig. Auto Setup Scene places these for you — you rarely add one by hand

Per-object — added to things you want to feel

ComponentWhat it does
HexRGrabbableMakes an object pickable by the HEXR hands — pinch or palm grab, with grab-strength haptics and OnGrab / OnRelease events. Needs a trigger Collider and a Rigidbody on the same GameObject
SpecialHapticsTurns a trigger collider into a haptic zone with a preset effect — fountain, raindrops, heartbeat, hand-squeeze, or custom pressure and vibration
HexRUsableFires events when specific fingers curl past a threshold — triggers, squeezes, grips
ProximityCheckTells HEXR that a hand is near this object. Required on OpenXR, optional on Meta OVR

Connecting the glove

Nothing connects on its own, and this is the most common reason a correctly built scene stays silent. Wire ConnectLeftBT() / ConnectRightBT() to a button, call them yourself once the scene is ready, or drop in the in-scene HexR Panel (HexR → Add HexR Panel) which already has the buttons on it.

csharp
// From anywhere, once the scene is up
HexRManager.Instance.ConnectLeftBT();
HexRManager.Instance.ConnectRightBT();

// Read back from a connected glove
float battery = HexRManager.Instance.leftHand.GetBatteryLevel();   // 0-1

Full signatures in the Unity (C#) reference.

Supported devices

HEXR relies on your headset (or an external tracker) for hand position and adds the touch layer on top — see Working with hand-tracking.

Samples

Window → Package Manager → HexR → Samples → Tutorial Content → Import brings in the tutorial props: a grabbable torch, a squeezable heart, a togglable lightbulb, and the connect and grab audio. The sample contains props only — there is no scene in it, because a saved scene would have to reference one backend's camera rig and would arrive broken for everyone on the other. Use HexR → Create Demo Scene to generate a working scene against whichever backend you installed, then drag these props into it. The tutorial projects also ship full scenes in Assets/Scenes/.