Skip to content

Commit 6fb0bb3

Browse files
committed
Add improvements based on review
1 parent ac75141 commit 6fb0bb3

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ public void Actions_DoNotGetTriggeredByOutOfFocusEventInEditor(InputSettings.Bac
687687
Assert.That(actions, Has.Length.EqualTo(backgroundBehavior == InputSettings.BackgroundBehavior.IgnoreFocus ? 2 : 1));
688688
Assert.That(actions[0].phase, Is.EqualTo(InputActionPhase.Performed));
689689
Vector2Control control = (Vector2Control)actions[0].control;
690+
// Make sure the value is from the event after focus was regained.
690691
Assert.That(control.value, Is.EqualTo(new Vector2(1.0f, 2.0f)).Using(Vector2EqualityComparer.Instance));
691692
}
692693
}

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ however, it has to be formatted properly to pass verification tests.
2828
- Fixed the compilation warnings when used with Unity 6.4 (ISX-2349).
2929
- Fixed an issue where `InputSystemUIInputModule.localMultiPlayerRoot` could not be set to `null` when using `MultiplayerEventSystem`. [ISXB-1610](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1610)
3030
- Fixed an issue in `Keyboard` where the sub-script operator would return a `null` key control for the deprecated key `Key.IMESelected`. Now, an aliased `KeyControl`mapping to the IMESelected bit is returned for compability reasons. It is still strongly advised to not rely on this key since `IMESelected` bit isn't strictly a key and will be removed from the `Key` enumeration type in a future major revision. [ISXB-1541](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1541).
31-
- An issue where a UITK MouseEvent was triggered when changing from Scene View to Game View in the Editor has been fixed. [ISXB-1671](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1671)
31+
- An issue where a UITK MouseEvent was triggered when changing from Scene View to Game View in the Editor has been fixed. [ISXB-1671](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1671)
3232

3333
## [1.14.2] - 2025-08-05
3434

Packages/com.unity.inputsystem/InputSystem/InputManager.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,7 +3210,9 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
32103210
var shouldFlushEventBuffer = ShouldFlushEventBuffer();
32113211
// When we exit early, we may or may not flush the event buffer. It depends if we want to process events
32123212
// later once this method is called.
3213-
var shouldExitEarly = ShouldExitEarlyFromEventProcessing(eventBuffer, shouldFlushEventBuffer, updateType);
3213+
var shouldExitEarly =
3214+
eventBuffer.eventCount == 0 || shouldFlushEventBuffer || ShouldExitEarlyFromEventProcessing(updateType);
3215+
32143216

32153217
#if UNITY_EDITOR
32163218
var dropStatusEvents = ShouldDropStatusEvents(eventBuffer, ref shouldExitEarly);
@@ -3692,16 +3694,8 @@ private bool ShouldFlushEventBuffer()
36923694
/// <param name="canFlushBuffer">Whether the buffer can be flushed</param>
36933695
/// <param name="updateType">The current update type</param>
36943696
/// <returns>True if we should exit early, false otherwise.</returns>
3695-
private bool ShouldExitEarlyFromEventProcessing(InputEventBuffer eventBuffer, bool canFlushBuffer, InputUpdateType updateType)
3697+
private bool ShouldExitEarlyFromEventProcessing(InputUpdateType updateType)
36963698
{
3697-
// Early out if there are no events to process
3698-
if (eventBuffer.eventCount == 0)
3699-
return true;
3700-
3701-
// Early out if we can flush the buffer
3702-
if (canFlushBuffer)
3703-
return true;
3704-
37053699
#if UNITY_EDITOR
37063700
// Check various PlayMode specific early exit conditions
37073701
if (ShouldExitEarlyInEditor(updateType))
@@ -3768,7 +3762,7 @@ private bool ShouldDropStatusEvents(InputEventBuffer eventBuffer, ref bool canEa
37683762
/// <summary>
37693763
/// Determines if an event should be discarded based on timing or focus state.
37703764
/// </summary>
3771-
/// <param name="eventType">The type of the current event</param>
3765+
/// <param name="eventType">The type of event</param>
37723766
/// <param name="eventTime">The internal time of the current event</param>
37733767
/// <param name="updateType">The current update type</param>
37743768
/// <returns>True if the event should be discarded, false otherwise.</returns>
@@ -3811,6 +3805,7 @@ private bool ShouldDiscardEditModeTransitionEvent(FourCC eventType, double event
38113805
/// </summary>
38123806
private bool ShouldDiscardOutOfFocusEvent(double eventTime)
38133807
{
3808+
// If we care about focus, check if the event occurred while out of focus based on its timestamp.
38143809
if (gameHasFocus && m_Settings.backgroundBehavior != InputSettings.BackgroundBehavior.IgnoreFocus)
38153810
return m_DiscardOutOfFocusEvents && eventTime < m_FocusRegainedTime;
38163811
return false;

0 commit comments

Comments
 (0)