Skip to content

Commit f3d9731

Browse files
author
lawwong
committed
Fix recognizing Oculus devices in UnityXRModule
1 parent c4d8800 commit f3d9731

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Assets/HTC.UnityPlugin/VRModule/Modules/UnityXRModuleBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private struct XRInputSubsystemProfile
8282
private uint uxrLeftIndex = INVALID_DEVICE_INDEX;
8383
private uint moduleRightIndex = INVALID_DEVICE_INDEX;
8484
private uint moduleLeftIndex = INVALID_DEVICE_INDEX;
85+
private string hmdDeviceName = string.Empty;
8586
private VRModule.SubmoduleBase.Collection submodules = new VRModule.SubmoduleBase.Collection(
8687
new ViveHandTrackingSubmodule(),
8788
new WaveHandTrackingSubmodule(),
@@ -149,7 +150,6 @@ public sealed override void BeforeRenderUpdate()
149150

150151
InputDevices.GetDevices(connectedDevices);
151152

152-
var hmdModelNum = string.Empty;
153153
foreach (var device in connectedDevices)
154154
{
155155
if (!indexMap.TryGetIndex(device, out deviceIndex))
@@ -161,14 +161,14 @@ public sealed override void BeforeRenderUpdate()
161161
deviceIndex = VRModule.HMD_DEVICE_INDEX;
162162
EnsureValidDeviceState(deviceIndex, out prevState, out currState);
163163
deviceName = device.name;
164-
hmdModelNum = deviceName + " - ";
164+
hmdDeviceName = deviceName + " - ";
165165
}
166166
else
167167
{
168168
// this function will skip VRModule.HMD_DEVICE_INDEX (preserved index for HMD)
169169
deviceIndex = FindAndEnsureUnusedNotHMDDeviceState(out prevState, out currState);
170170
indexMap.MapNonHMD(device, deviceIndex);
171-
deviceName = hmdModelNum + device.name;
171+
deviceName = hmdDeviceName + device.name;
172172
}
173173

174174
currState.deviceClass = GetDeviceClass(device.name, device.characteristics);

0 commit comments

Comments
 (0)