Skip to content

Commit 799b0ad

Browse files
committed
Small hotswap UI fix
1 parent 68c9f9c commit 799b0ad

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Source/Managers/HotswapManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ private static void HotswapEnableVR()
4646
RestartScene();
4747
else
4848
{
49-
MenuManager.instance.PageCloseAll();
49+
// Close existing popup if one is open
50+
if (MenuPagePopUp.instance != null)
51+
MenuPagePopUp.instance.ButtonEvent();
52+
5053
MenuManager.instance.PagePopUp("VR Startup Failed", Color.red,
5154
"RepoXR tried to swap the game to VR, however an error occured during initialization.\n\nYou can update your settings and press F8 to try again.",
5255
"Darn it",

Source/Player/VREyeTracking.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private void Awake()
2828

2929
Plugin.Config.EnableEyeTracking.SettingChanged += OnEyeTrackingSettingChanged;
3030

31+
// TODO: Remove once tested with real hardware
3132
debugCube = Instantiate(AssetCollection.Cube).transform;
3233
debugCube.GetComponent<MeshRenderer>().material.color = Color.blue;
3334
debugCube.GetComponent<Collider>().enabled = false;
@@ -46,18 +47,28 @@ private void OnDestroy()
4647

4748
private void OnEyeGazePosition(InputAction.CallbackContext ctx)
4849
{
50+
gazePosition = ctx.ReadValue<Vector3>();
51+
52+
// Sometimes the OpenXR runtime misfires and triggers eye tracking callbacks even when it doesn't support it
53+
// In that case the data is always 0, so we can just discard the event if we didn't already have data before
54+
if (!supported && gazePosition == Vector3.zero)
55+
return;
56+
4957
supported = true;
5058
lastHardwareInput = Time.realtimeSinceStartup;
51-
52-
gazePosition = ctx.ReadValue<Vector3>();
5359
}
5460

5561
private void OnEyeGazeRotation(InputAction.CallbackContext ctx)
5662
{
63+
gazeRotation = ctx.ReadValue<Quaternion>();
64+
65+
// Sometimes the OpenXR runtime misfires and triggers eye tracking callbacks even when it doesn't support it
66+
// In that case the data is always 0, so we can just discard the event if we didn't already have data before
67+
if (!supported && gazeRotation == Quaternion.identity)
68+
return;
69+
5770
supported = true;
5871
lastHardwareInput = Time.realtimeSinceStartup;
59-
60-
gazeRotation = ctx.ReadValue<Quaternion>();
6172
}
6273

6374
private static void OnEyeTrackingSettingChanged(object sender, EventArgs e)

0 commit comments

Comments
 (0)