How can I set the Tracking Origin Mode when using Unity XR?

Get Input Subsystem

To change the tracking origin, retrieve the XRInputSubsystem first.

UnityEngine.XR.XRInputSubsystem m_InputSystem = null;
private void Start()
{
        List<UnityEngine.XR.XRInputSubsystem> subsystems = new List<UnityEngine.XR.XRInputSubsystem>();
        SubsystemManager.GetInstances(subsystems);
        foreach (var subsystem in subsystems)
        {
                if (subsystem.SubsystemDescriptor.id.Equals("WVR Input Provider"))
                {
                        m_InputSystem = subsystem;
                        break;
                }
        }
}

Change Tracking Origin

After retrieving the XRInputSubsystem, refer to the TrackingOriginMode and use the following sample code to change the Tracking Origin.

void SetTrackingOrigin(UnityEngine.XR.TrackingOriginModeFlags flag)
{
        if (m_InputSystem != null)
                m_InputSystem.TrySetTrackingOriginMode(flag);
}