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 f8119d8058..a856ea9440 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a control declared for several variants at once (for example `"variants" : "A;B"`) only merging with derived layouts under its first variant; derived overrides for the other variants lost the base control's layout, offset, format and usages. [UUM-160829](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-160829) - Fixed duplicate entries appearing in the Input Actions Editor binding path search for some devices, such as Mouse and XR controllers. [UUM-160646](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-160646) - Fixed closed Input Device Debugger windows staying in memory until the next domain reload. [ISX-3179] +- 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 985954c8a0..9a2ce13ae9 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;