Microtube Docs
Developers / Unity / Scene setup

Unity scene setup

Put hands and the HEXR rig in your scene, and connect the gloves.

What a HEXR scene needs

Four things. Your XR SDK supplies the hands; HexR → Create HexR Rig adds the rest in one go.

In the sceneWhat it doesAdded by
Tracked handsWhere the hands are. HEXR puts a touch point on each fingertip and the palm, so it knows which finger touched whatYour XR SDK — see the steps below
HexR MainThe rig. Its HexRManager connects both gloves, and one Hand Physics object per glove holds that glove’s Bluetooth link. It survives scene changesCreate HexR Rig
Left and Right Pressure ControllerEvery haptic goes through them. A scene without an active pair feels nothingCreate HexR Rig, or HexR → Add Pressure Controller
HexR menuThe panel in the headset for connecting the gloves — see belowCreate HexR Rig, or HexR → Add HexR Menu

Build a new scene

Quickest: HexR → Create Demo Scene makes a ready-to-try scene with the rig, a haptic sphere and a cube you can grab. It can’t add hands, so do step 1 below, then run HexR → Troubleshoot → Re-run Auto Setup.

Or build it yourself:

  1. Add hands

    HEXR attaches to hands that are already in the scene; it doesn’t make its own. Add a rig that puts them in the Hierarchy:

    BackendAdd this
    Meta OVRMeta → Tools → Building Blocks → Interactions Rig. Not the Hand Tracking block: its hands only appear once the app runs, too late for HEXR
    OpenXR or PICOIn Window → Package Manager → XR Interaction Toolkit → Samples, import Hands Interaction Demo and drag its XR Origin Hands (XR Rig) prefab into the scene. Delete the scene’s Main Camera — the rig has its own

    Check: search the Hierarchy for OpenXRLeftHand (Meta) or L_Wrist (OpenXR). If nothing comes up, there are no hands yet.

  2. Add the HEXR rig

    Run HexR → Create HexR Rig → your backend. It adds HexR Main and the Pressure Controllers, then runs Auto Setup, which puts touch points on the hands.

  3. Validate

    Run HexR → Troubleshoot → Validate Scene Setup and fix anything it lists. It catches mistakes that would otherwise look like a broken glove.

  4. Connect a glove

    Power on the arm module. In a headset build, press Connect Left Glove or Connect Right Glove on the HexR menu. In the Unity Editor on Windows, press Play and connect from HexR → HexR Tools → HexR Haptics Tester. The first time on a headset, allow the Bluetooth permission — see Allow Bluetooth on the headset.

If Auto Setup can’t find something

Adding HEXR to an existing project

  1. Install the package

    Follow Project setup. Install from the git URL — don’t copy HEXR folders out of a tutorial project, which gives you duplicate code and a compile error. Moving up from an older HEXR? Read the changelog first.

  2. Check your hands

    HEXR finds your rig’s hands by their joint names, so they need to come from Meta’s Interaction SDK or Unity’s XR Hands (the names are in The HEXR scene). Search the Hierarchy for OpenXRLeftHand (Meta) or L_Wrist (OpenXR). Nothing there? Your hands only appear once the app runs — see step 1 of Build a new scene.

  3. Add the rig to the scene your app starts in

    Run HexR → Create HexR Rig → your backend. It adds HexR Main and the Pressure Controllers, and Auto Setup puts touch points on your existing hands and wires your grab and poke interactors. Your camera rig, hands and objects stay as they are. Then run HexR → Troubleshoot → Validate Scene Setup.

  4. Add Pressure Controllers to every other scene

    HexR Main carries over when a scene loads and finds that scene’s hands by itself, but each scene needs its own pair of Pressure Controllers: run HexR → Add Pressure Controller in each one.

  5. Make your objects felt

    Put HexRInteractableHaptics next to the interactables you already have — XR Grab Interactable on OpenXR, or Meta’s Grabbable and Hand Grab Interactable. For anything else, see Which component do I need?

The panel that floats in the headset. Its main job is connecting the gloves over Bluetooth. It comes with the rig, to the user’s left and facing them; press its buttons with a real fingertip. To add it to a scene of your own, use HexR → Add HexR Menu.

The top of the HexR menu: the GLOVES and VIEW sections
The top of the HexR menu. GLOVES connects each glove; VIEW shows the touch points.
On the menuWhat it does
Connect Left Glove / Connect Right GloveConnects that glove, then shows it is ready with its battery level. Press again to disconnect
Show CollidersDraws every touch point on the tracked hands, so you can see they follow your fingers
HAPTICSShows live what was last sent to each finger and the palm of each glove
Scene switcherMoves between scenes and demos

Using your own menu instead

You don’t have to use the HexR menu. From SDK 0.9.4, HEXR works without it, so you can connect from your own buttons or straight from code and leave it out. These are the calls, all on HexRManager.Instance:

csharp
HexRManager rig = HexRManager.Instance;
var left = HaptGloveHandler.HandType.Left;   // or HandType.Right

rig.Connect(left);       // connect; asks for Bluetooth permission where needed,
                         // does nothing if already connected or connecting
rig.Disconnect(left);    // release the glove, then disconnect

bool connected  = rig.IsConnected(left);
bool connecting = rig.IsConnecting(left);        // includes waiting for permission or a retry
float battery   = rig.leftHand.GetBatteryLevel();   // 0-1, once connected

A ready-made script for your own buttons. Put it on any object, point each UI Button’s On Click () at one of its four methods, and wire Status Changed to a text field to show what is happening.

csharp
using UnityEngine;
using UnityEngine.Events;
using HaptGlove;
using HexR;

// Connect buttons of your own, instead of the HexR menu. Point each UI Button's
// On Click () at one of the four methods, and wire Status Changed to a text field.
public class GloveButtons : MonoBehaviour
{
    public UnityEvent<string> statusChanged;

    public void ConnectLeft()     => HexRManager.Instance.Connect(HaptGloveHandler.HandType.Left);
    public void ConnectRight()    => HexRManager.Instance.Connect(HaptGloveHandler.HandType.Right);
    public void DisconnectLeft()  => HexRManager.Instance.Disconnect(HaptGloveHandler.HandType.Left);
    public void DisconnectRight() => HexRManager.Instance.Disconnect(HaptGloveHandler.HandType.Right);

    void Start()
    {
        HexRManager rig = HexRManager.Instance;
        rig.leftHand.onBluetoothConnected += OnConnected;
        rig.rightHand.onBluetoothConnected += OnConnected;
        rig.leftHand.onBluetoothDisconnected += OnDisconnected;
        rig.rightHand.onBluetoothDisconnected += OnDisconnected;
    }

    void OnDestroy()
    {
        HexRManager rig = HexRManager.Instance;
        if (rig == null) return;
        rig.leftHand.onBluetoothConnected -= OnConnected;
        rig.rightHand.onBluetoothConnected -= OnConnected;
        rig.leftHand.onBluetoothDisconnected -= OnDisconnected;
        rig.rightHand.onBluetoothDisconnected -= OnDisconnected;
    }

    void OnConnected(HaptGloveHandler.HandType hand)    => statusChanged.Invoke(hand + " glove connected");
    void OnDisconnected(HaptGloveHandler.HandType hand) => statusChanged.Invoke(hand + " glove disconnected");
}
In the Unity Editor

Connect from HexR → HexR Tools → HexR Haptics Tester instead. Connect uses each glove’s Build Platform, which the rig ships set to Android; the tester is what switches it to Windows for Play mode.

To connect as soon as the scene starts, with no button at all, use Connect both gloves from code. Every connection event is listed under Events.

Put the app on the headset

Build straight from Unity, or install an APK file. Either way, the headset needs developer mode first.

Turn on developer mode

Once per headset.

HeadsetHow
Meta QuestIn the Meta Horizon app on your phone, open your headset’s settings and turn on Developer Mode. Meta may ask you to set up a free developer account first
PICOOn the headset, go to Settings → General → About and tap the software version until developer options appear, then turn on Settings → Developer → USB Debugging

Then plug the headset into your computer with a USB cable and accept the Allow USB debugging prompt inside the headset.

From Unity

With the headset plugged in, go to File → Build Profiles → Android → Switch Platform, then press Build And Run. Unity installs the app and starts it. To get an APK file to share instead, press Build.

From an APK file

shell
adb install -r YourApp.apk

Finding it on the headset: installed apps don’t sit with your store apps. On Quest, open the app library and choose Unknown Sources; on PICO, look in the Library’s unknown-sources filter.

Allow Bluetooth on the headset

The first time the app connects a glove, the headset asks for permission to use Bluetooth. Allow it. If it is refused, the app keeps running but never finds the glove. The HexR menu and HexRManager.Instance.Connect(...) both ask for it for you.

HeadsetThe permission is calledRefused it? Turn it on under
Meta Quest 2, 3, 3SNearby devicesSettings → Privacy and Security → App Permissions, then restart the app
PICO 4, PICO 4 UltraLocation on the PICO 4; Nearby devices on headsets running Android 12 or laterSettings → Apps → your app → Permissions, then restart the app
Glove won’t connect?

Check this permission first, before the glove or your project.