From 0a70ac3cc702481e959cf7d83ceb00b1244f4a6d Mon Sep 17 00:00:00 2001 From: Chris Rodriguez Date: Thu, 15 Oct 2026 11:26:13 -0700 Subject: [PATCH 1/2] FIX: Inherit canRunInBackground from the base layout (UUM-139700) MergeLayout inherited updateBeforeRender from the base layout but not canRunInBackground. Generated XR HMD layouts therefore lost XRHMD's canRunInBackground = true and fell back to QueryCanRunInBackground, whose result is cached for the device's lifetime. If that query failed while the XR provider was reconnecting devices after an app pause, the HMD was reset on every focus loss and the view froze at the tracking origin. Co-Authored-By: Claude Opus 5.5 (1M context) --- Assets/Tests/InputSystem/Plugins/XRTests.cs | 20 +++++++++++++++++++ .../Runtime/Controls/InputControlLayout.cs | 3 +++ 2 files changed, 23 insertions(+) diff --git a/Assets/Tests/InputSystem/Plugins/XRTests.cs b/Assets/Tests/InputSystem/Plugins/XRTests.cs index b67fd13ffa..f5470e58b6 100644 --- a/Assets/Tests/InputSystem/Plugins/XRTests.cs +++ b/Assets/Tests/InputSystem/Plugins/XRTests.cs @@ -52,6 +52,26 @@ public void Devices_XRDeviceCharacteristicsDeterminesTypeOfDevice(InputDeviceCha Assert.That(generatedLayout.baseLayouts, Is.EquivalentTo(new[] { new InternedString(baseLayoutName) })); } + [Test] + [Category("Devices")] + public void Devices_XRHMDLayoutInheritsCanRunInBackgroundFromBaseLayout() + { + var deviceDescription = CreateSimpleDeviceDescriptionByType(InputDeviceCharacteristics.HeadMounted); + runtime.ReportNewInputDevice(deviceDescription.ToJson()); + + InputSystem.Update(); + + var baseLayout = InputSystem.LoadLayout("XRHMD"); + var generatedLayout = InputSystem.LoadLayout( + $"{XRUtilities.InterfaceCurrent}::{deviceDescription.manufacturer}::{deviceDescription.product}"); + + Assert.That(baseLayout.canRunInBackground, Is.Not.Null); + Assert.That(generatedLayout.canRunInBackground, Is.EqualTo(baseLayout.canRunInBackground)); + + // No device command callback is registered, so QueryCanRunInBackground fails (UUM-139700) + Assert.That(InputSystem.devices[0].canDeviceRunInBackground, Is.EqualTo(baseLayout.canRunInBackground.Value)); + } + [Test] [Category("Devices")] public void Devices_CanChangeHandednessOfXRController() diff --git a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlLayout.cs b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlLayout.cs index 7a5be95c37..3d2277f52e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlLayout.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlLayout.cs @@ -1301,6 +1301,9 @@ public void MergeLayout(InputControlLayout other) m_UpdateBeforeRender = m_UpdateBeforeRender ?? other.m_UpdateBeforeRender; + if (canRunInBackground == null) + canRunInBackground = other.canRunInBackground; + if (m_Variants.IsEmpty()) m_Variants = other.m_Variants; From 058cafc032809a161aea56940cc190eaae326339 Mon Sep 17 00:00:00 2001 From: Chris Rodriguez Date: Thu, 15 Oct 2026 17:03:48 -0700 Subject: [PATCH 2/2] Added changelog entry for UUM-139700 --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index b16cbcca2a..04ba8f7fab 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Fixed polling for interaction phases (such as `WasPerformedThisFrame`) being missed during `Update` due to interaction timeouts sometimes occurring during the later before-render period when a before-render device (such as an XR HMD) is added. This means that timeouts and interactions like Hold may now wait to perform until the next frame instead of the earliest chance during before-render. [UUM-147719](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-147719) +- Fixed XR HMD device regeneration not copying the `canRunInBackground` parameter from its base layout, causing the XR app view to become locked to the tracking origin and frozen in place when the application regained focus after the headset went to sleep or a system menu was opened. [UUM-139700](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-139700) ## [1.20.1] - 2026-10-05