Skip to content

Integrate your app

The com.xrdevrob.geppetto Unity package exposes three things a test can use: stable targets to aim at, product state to assert, and fixtures that arrange the starting state. Expose only what important tests need; do not mirror the whole hierarchy.

All three reach the runner as app tools on the app's Geppetto channel: the package serves them on 127.0.0.1, behind a token, when the app runs with PUPPETXR_CONTROL=1 (or GEPPETTO_APP_TOOLS=1), and geppetto run finds the channel by the app's process. Nothing else needs setting up, and any PuppetXR build works. If the app announces a channel that does not answer (just stopped, or crashed), geppetto run warns and asks PuppetXR instead; if the channel drops during a run, the remaining tests are not run. geppetto run checks that the app offers the tools a test needs before sending any input, and stops with an error otherwise.

The channel exists only in the Editor and in development builds; a release build does not contain it. A tool runs on Unity's main thread in the next frame, so it sees the app as the app's own code does. While PuppetXR holds the app paused, a tool call may wait for it to resume.

The optional Geppetto App Tools OpenXR feature registers the same tools through XR_METAX1_agentic_external_tool, for Meta XR Operator. Geppetto does not need it, and a non-development build fails while it, or Meta's Operator API layer, is enabled.

The package's PuppetXR Demo sample (Package Manager → Samples) shows all three in one script: a cube with a target, a state provider that counts hits and misses, and a reset fixture, with a test that uses each.

Add stable targets

Unframed's home screen with the tracked right hand aiming at the Watch button

A point step aimed at the Geppetto target unframed.home.watch: Geppetto asks the app where the target is in the eye's image, so the test keeps working when the layout changes. Footage: Unframed by Ambient Intent on PuppetXR, recorded by Geppetto; Singularity (2026) © Blender Studio / Blender Foundation, CC BY 4.0.

Add a GeppettoTarget component to the object a test aims at, and give it an ID that stays stable when designers rename or move GameObjects:

menu.open
assembly.piece.coral
settings.volume

Treat these IDs as an automation API. A point step with target asks the app where the target is in the chosen eye's image and aims at its centre. The step fails before moving the hand when the app cannot locate the target or it is out of view. The app's reply (geppetto_mark_evidence_target) also gives eyeDistance, the metres from that eye's camera position to the target's centre, measured in Unity world units. A point with from: body uses it to aim the hand's own ray at the target in 3D; it is 0 when the app cannot tell, and an app built with an older package leaves it out, in which case that step fails with a clear error. It assumes an unscaled XR rig, where a world unit is a metre.

For a world-space UI Toolkit document (Unity 6.2 or newer), add one GeppettoUiToolkitTarget per control a test uses, on the same GameObject as the live UIDocument and its panel-sized BoxCollider. Set the target ID and the control's exact UXML name. Put it on the interactive element, such as the Slider, rather than a decorative overlay.

From code, GeppettoTarget.Configure(id, description) sets the ID at runtime.

Expose product state

Implement IGeppettoStateProvider on a component that reads the app's real state, and register it while it is enabled:

using UnityEngine;
using XRDevRob.Geppetto;

public sealed class MenuQaState : MonoBehaviour, IGeppettoStateProvider
{
    [SerializeField] private MainMenu menu;

    public string ProviderId => "menu";

    private void OnEnable() => GeppettoRegistry.Register(this);
    private void OnDisable() => GeppettoRegistry.Unregister(this);

    public string CaptureStateJson() =>
        JsonUtility.ToJson(new Snapshot { open = menu.IsOpen, page = menu.CurrentPage });

    [System.Serializable]
    private struct Snapshot
    {
        public bool open;
        public string page;
    }
}

A test then asserts it:

{"expect": "state", "provider": "menu", "path": "open", "equals": true}

CaptureStateJson must return a JSON object. Read the state the product already keeps; do not reproduce business rules or keep a flag that exists only for the test. Keep secrets, personal data and device identifiers out of it.

The reserved geppetto-runtime provider reports scene readiness and focus. It shows the adapter is connected, not that product behavior worked; do not register your own provider with that ID.

With the app running on PuppetXR, geppetto inspect lists its targets, each state provider's current value and its actions, so you can check what you added and copy IDs and paths into a test.

Add fixtures

Singularity paused at 0:30 in Unframed, its light spilling into the simulated room

An action step: Unframed's unframed.inspect fixture starts the film at 0:30, paused, and a state expectation checks the film time it reports. Footage: Unframed by Ambient Intent on PuppetXR, recorded by Geppetto; Singularity (2026) © Blender Studio / Blender Foundation, CC BY 4.0.

Implement IGeppettoActionHandler for each setup or reset a test needs, and register it while it is enabled:

using UnityEngine;
using XRDevRob.Geppetto;

public sealed class ResetMenuFixture : MonoBehaviour, IGeppettoActionHandler
{
    [SerializeField] private MainMenu menu;

    public string ActionId => "menu.reset";
    public string Description => "Closes the menu and returns to the home page.";
    public bool IsProjectMutation => false;

    private void OnEnable() => GeppettoRegistry.Register(this);
    private void OnDisable() => GeppettoRegistry.Unregister(this);

    public string Invoke(string argumentsJson)
    {
        menu.CloseAndGoHome();
        return "{}";
    }
}

A test runs it with an action step, passing a JSON object that arrives as argumentsJson:

{"do": "action", "action": "menu.reset", "arguments": {}}

A fixture arranges state; it must never perform the interaction a test is checking. Throw an exception to report a failure; the test then stops with that message. geppetto run never confirms an action, so the app refuses any handler whose IsProjectMutation is true. Keep handlers that change project files out of Geppetto tests.

Build a player for PuppetXR runs

Tests run fastest and stay out of the way against a development player started with geppetto run --app. Set, for that build:

  • Development Build on: app tools exist only in development builds.
  • Run In Background on, so the player keeps rendering while it is not in front.
  • VSync off in every quality level (QualitySettings.vSyncCount = 0). PuppetXR's xrWaitFrame paces the XR frames; vsync on the player's own window holds every frame to the desktop display's rate as well, about 60 Hz, below PuppetXR's 90. On the demo player that kept runs under PuppetXR's fixed step (geppetto run --app … --fixed-step) slower than real time: the pinch test took 3.1 s, against 1.0 s with vsync off and 1.6 s in real time. On a headset the XR runtime paces frames and this setting does not apply.
  • XRSettings.renderViewportScale at 1. On macOS, Unity's Metal path draws a reduced viewport at the bottom of the eye image but tells the runtime it is at the top, so the image PuppetXR composes shifts down by (1 − scale) / scale of its height.

The PuppetXR Demo sample's build script sets the first three; the demo never changes the viewport scale.

The Editor's Play mode works too (start Unity with PUPPETXR_CONTROL=1, then geppetto run --target <Editor pid>), but only while you watch it: a hidden or unfocused Editor stops ticking during Play mode switches and while loading, so runs in the background, in CI or while you use the machine belong on a player.