Skip to content

Exchange And Remote Control

Exchange is the live, bidirectional control layer between Unity devices and the XRXP dashboard.

What exchange does

With exchange, a Unity app can:

  • publish live status values to the dashboard
  • declare controls that operators can trigger
  • react to remote commands without custom transport code

Main pieces

ExchangeModality

A ScriptableObject that defines:

  • status fields sent from Unity to the dashboard
  • control fields exposed in the dashboard and sent back to Unity

XRXPExchangeManager

The runtime component that:

  • connects to the WebSocket service
  • sends modality schema and status updates
  • receives control commands
  • dispatches them on the Unity main thread

Status example

exchangeManager.SetStatus("currentScene", "Tutorial");
exchangeManager.SetStatus("playerHealth", 85);
exchangeManager.SetStatus("isReady", true);

Control handling options

Inspector bindings

Use UnityEvents wired in the XRXPExchangeManager inspector.

[ExchangeControl] attribute

Use code-driven handlers discovered automatically at runtime.

using XRXP;

public class SceneActions : UnityEngine.MonoBehaviour
{
    [ExchangeControl("changeScene")]
    private void HandleChangeScene(string sceneName)
    {
        UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
    }
}

Good use cases

  • remote scene switching
  • live experiment state display
  • operator-triggered tasks or calibration
  • simple device controls without a custom protocol