Skip to content

Commit f0667c2

Browse files
committed
fixed race condisions
1 parent d6969a4 commit f0667c2

6 files changed

Lines changed: 12 additions & 9 deletions

File tree

Assets/VRstudios/XRInput/API/UnityEngine_XR.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override void Init()
2727

2828
// add existing devices (this is needed to handle OVR bug where left controller may not be added via callbacks)
2929
InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.Controller, controllers);
30-
foreach (var c in controllers) UpdateDevice(c, false);
30+
foreach (var c in controllers.ToArray()) UpdateDevice(c, false);
3131

3232
// watch for device changes
3333
InputDevices.deviceConnected += InputDevices_deviceConnected;

Assets/VRstudios/XRInput/XRInput.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public sealed class XRInput : MonoBehaviour
3636
public XRLoader loaderOverride;
3737
public XRInputAPIType apiType;
3838
private XRInputAPI api;
39-
private bool disposeAPI;
39+
private bool disposeAPI, apiInit;
4040

4141
private const int controllerStateLength = 4;
4242
private int lastControllerCount;
@@ -61,7 +61,7 @@ private IEnumerator Start()
6161
singleton = this;
6262

6363
// print version
64-
Debug.Log("XRInput version: 1.0.9");
64+
Debug.Log("XRInput version: 1.0.10");
6565

6666
// wait for XR loader
6767
while (loader == null || !XRSettings.enabled)
@@ -130,6 +130,8 @@ private IEnumerator Start()
130130
#if UNITY_EDITOR
131131
UnityEditor.EditorApplication.playModeStateChanged += EditorApplication_playModeStateChanged;
132132
#endif
133+
134+
apiInit = true;
133135
}
134136
catch (Exception e)
135137
{
@@ -153,6 +155,7 @@ private void OnDestroy()
153155
UnityEditor.EditorApplication.playModeStateChanged -= EditorApplication_playModeStateChanged;
154156
#endif
155157

158+
apiInit = false;
156159
if (disposeAPI && api != null)
157160
{
158161
api.Dispose();
@@ -169,7 +172,7 @@ private void OnApplicationQuit()
169172
private void Update()
170173
{
171174
// gather controller states from current API
172-
if (api == null) return;
175+
if (!apiInit) return;
173176

174177
int controllerCount;
175178
bool leftSet, rightSet;

Assets/XR/Settings/Open XR Package Settings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4614,7 +4614,7 @@ MonoBehaviour:
46144614
- {fileID: 7982965482703915569}
46154615
- {fileID: 7140447362601613340}
46164616
- {fileID: 9170940577884563102}
4617-
m_renderMode: 0
4617+
m_renderMode: 1
46184618
m_depthSubmissionMode: 0
46194619
--- !u!114 &6169546649005359584
46204620
MonoBehaviour:

Packages/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"com.unity.xr.management": "4.0.7",
2121
"com.unity.xr.mock-hmd": "1.3.0-preview.1",
2222
"com.unity.xr.oculus": "1.9.1",
23-
"com.unity.xr.openxr": "1.2.3",
23+
"com.unity.xr.openxr": "1.2.8",
2424
"com.unity.xr.picoxr": "file:../ExternalPackages/PicoXR_Platform_SDK-1.2.3_B55.tar.tgz",
2525
"com.unity.xr.windowsmr": "4.5.0",
2626
"com.valvesoftware.unity.openvr": "file:../ExternalPackages/com.valvesoftware.unity.openvr-1.1.4.tgz",

Packages/packages-lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
"url": "https://packages.unity.com"
192192
},
193193
"com.unity.xr.openxr": {
194-
"version": "1.2.3",
194+
"version": "1.2.8",
195195
"depth": 0,
196196
"source": "registry",
197197
"dependencies": {

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2020.3.14f1
2-
m_EditorVersionWithRevision: 2020.3.14f1 (d0d1bb862f9d)
1+
m_EditorVersion: 2020.3.15f2
2+
m_EditorVersionWithRevision: 2020.3.15f2 (6cf78cb77498)

0 commit comments

Comments
 (0)