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/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 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;