Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
063ddb9
reduce complexity for checking UI interactions in update - frame base…
ritamerkl Jan 22, 2025
5067af8
added changelog
ritamerkl Jan 22, 2025
29c0eda
changelog formatting
ritamerkl Jan 22, 2025
7beeb2b
switch to additional InFrame and InputSystem update logic
ritamerkl Jan 23, 2025
b6e48dc
fixed wrong reference to update instead of frame
ritamerkl Jan 23, 2025
ea856c3
temporary workaround for rebinding test
ritamerkl Jan 24, 2025
a814fa2
save frame count when status changed
ritamerkl Jan 24, 2025
e581aad
fixed frame state saving
ritamerkl Jan 24, 2025
94b59a1
switched to coroutine with rebinding test to fix UI submit framebased…
ritamerkl Jan 24, 2025
65b20c9
removed redundant frame from InputActionState and InputAction
ritamerkl Jan 24, 2025
18dedda
Removed m_Frame
ritamerkl Jan 24, 2025
6e01bb1
Merge remote-tracking branch 'origin/develop' into fix-ui-behavior-fo…
ritamerkl Feb 3, 2025
b486ebd
changed to proposal 2
ritamerkl Feb 4, 2025
f49ccf0
fix comments in InputAction tests
ritamerkl Feb 4, 2025
39e057c
Fixed spelling
ritamerkl Feb 4, 2025
cb8cc82
updated documentation
ritamerkl Feb 7, 2025
9d8b5b4
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
ritamerkl Feb 7, 2025
e9367a4
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
Pauliusd01 Feb 10, 2025
adeddc9
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
ritamerkl Feb 12, 2025
e3b1a38
Update CHANGELOG.md
ritamerkl Feb 12, 2025
7114e6f
skip properties
ritamerkl Feb 12, 2025
8332195
added tests
ritamerkl Feb 12, 2025
95e4bfc
update version to 1.14.0
stefanunity Feb 13, 2025
2b4d758
fixed doc
ritamerkl Feb 14, 2025
b826dc2
Merge branch 'fix-ui-behavior-for-update-non-dynamic' of https://gith…
ritamerkl Feb 14, 2025
49fe0dc
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
ritamerkl Feb 14, 2025
998fcda
Update CHANGELOG.md
ritamerkl Feb 14, 2025
8eee052
fix formatting for changelog
ritamerkl Feb 14, 2025
e6cc47a
fix formatting
ritamerkl Feb 14, 2025
c37b912
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
ritamerkl Feb 14, 2025
51b9643
update comment
ritamerkl Feb 19, 2025
676ad0f
Changed naming from RenderingFrame to DynamicUpdate
ritamerkl Feb 21, 2025
fc0bfed
Merge remote-tracking branch 'origin/develop' into fix-ui-behavior-fo…
ritamerkl Feb 21, 2025
92d8773
Fixed comments for rename of method done earlier in 676ad0f
chris-massie Feb 27, 2025
f1af620
update comment
ritamerkl Feb 28, 2025
1deb9ac
Update Packages/com.unity.inputsystem/InputSystem/Actions/InputAction.cs
ritamerkl Feb 28, 2025
6abb34e
update comment
ritamerkl Feb 28, 2025
daa9dc4
update comment
ritamerkl Feb 28, 2025
267954a
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
ritamerkl Mar 3, 2025
40b8910
added line of documentation to explain frame delay
ritamerkl Mar 10, 2025
440af88
added help box to indicate the InputSystem update mode is not recomme…
ritamerkl Mar 10, 2025
3a12620
Merge branch 'develop' into fix-ui-behavior-for-update-non-dynamic
ritamerkl Mar 10, 2025
73725ef
update text
ritamerkl Mar 12, 2025
73aec85
replace link with static to make it easier upgradeable
ritamerkl Mar 12, 2025
d422bf4
Merge branch 'fix-ui-behavior-for-update-non-dynamic' of https://gith…
ritamerkl Mar 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.13.1
// version 1.14.0
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/SimpleDemo/SimpleControls.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.13.1
// version 1.14.0
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
6 changes: 3 additions & 3 deletions Assets/Samples/UIvsGameInput/UIvsGameInputHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void Update()
transform.rotation = default;

// When using a pointer-based control scheme, we engage camera look explicitly.
if (m_ControlStyle != ControlStyle.GamepadJoystick && m_LookEngageAction.WasPressedThisFrame() && IsPointerInsideScreen())
if (m_ControlStyle != ControlStyle.GamepadJoystick && m_LookEngageAction.WasPressedThisRenderingFrame() && IsPointerInsideScreen())
EngageCameraControl();

// With gamepad/joystick, we can freely rotate the camera at any time.
Expand Down Expand Up @@ -166,14 +166,14 @@ public void Update()
if (m_Mouse != null)
m_MousePositionToWarpToAfterCursorUnlock = m_MousePositionToWarpToAfterCursorUnlock.Value + m_Mouse.delta.ReadValue();

if (m_CancelAction.WasPressedThisFrame() || !m_LookEngageAction.IsPressed())
if (m_CancelAction.WasPressedThisRenderingFrame() || !m_LookEngageAction.IsPressed())
DisengageCameraControl();

break;

case State.InMenu:

if (m_CancelAction.WasPressedThisFrame())
if (m_CancelAction.WasPressedThisRenderingFrame())
OnContinueClicked();

break;
Expand Down
114 changes: 114 additions & 0 deletions Assets/Tests/InputSystem/CoreTests_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,120 @@ public void Settings_ShouldStoreSettingsAndFeatureFlags(string featureName)
}
}

[UnityTest]
[Category("Actions")]
public IEnumerator Actions_WasStateReachedThisRenderingFrameOperatesIndependentlyFromInputUpdateStep()
{
var updateMode = InputSystem.settings.updateMode;
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsInDynamicUpdate;

var gamepad = InputSystem.AddDevice<Gamepad>();
var simpleAction = new InputAction(binding: "<Gamepad>/buttonSouth");
simpleAction.Enable();

Assert.That(simpleAction.WasPerformedThisRenderingFrame(), Is.False);
Assert.That(simpleAction.WasPressedThisRenderingFrame(), Is.False);
Assert.That(simpleAction.WasReleasedThisRenderingFrame(), Is.False);
Assert.That(simpleAction.WasCompletedThisRenderingFrame(), Is.False);

PressAndRelease(gamepad.buttonSouth);

yield return null; // InputSystem.Update is called and the action state chenges

Assert.That(simpleAction.WasPerformedThisRenderingFrame(), Is.True);
Assert.That(simpleAction.WasPressedThisRenderingFrame(), Is.True);
Assert.That(simpleAction.WasReleasedThisRenderingFrame(), Is.True);

InputSystem.Update(); // a manual update happens between two frames, that does not affect the output of the WasPerformedThisRenderingFrame

Assert.That(simpleAction.WasPerformedThisRenderingFrame(), Is.True);
Assert.That(simpleAction.WasPressedThisRenderingFrame(), Is.True);
Assert.That(simpleAction.WasReleasedThisRenderingFrame(), Is.True);

//Reset State
InputSystem.settings.updateMode = updateMode;
}

[UnityTest]
[Category("Actions")]
public IEnumerator Actions_WasStateReachedThisFrameOperatesIndependentlyFromRenderingFrame()
{
var updateMode = InputSystem.settings.updateMode;
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsManually;

var gamepad = InputSystem.AddDevice<Gamepad>();
var simpleAction = new InputAction(binding: "<Gamepad>/buttonSouth");
simpleAction.Enable();

Assert.That(simpleAction.WasPerformedThisFrame(), Is.False);
Assert.That(simpleAction.WasPressedThisFrame(), Is.False);
Assert.That(simpleAction.WasReleasedThisFrame(), Is.False);
Assert.That(simpleAction.WasCompletedThisFrame(), Is.False);

PressAndRelease(gamepad.buttonSouth);

yield return null; // InputSystem.Update is not called and the action state does not change
yield return null;
yield return null;

Assert.That(simpleAction.WasPerformedThisFrame(), Is.False);
Assert.That(simpleAction.WasPressedThisFrame(), Is.False);
Assert.That(simpleAction.WasReleasedThisFrame(), Is.False);

InputSystem.Update(); // a manual update happens between two frames, that does not affect the output of the WasXYZThisRenderingFrame but does affect the WasXYZThisFrame

Assert.That(simpleAction.WasPerformedThisFrame(), Is.True);
Assert.That(simpleAction.WasPressedThisFrame(), Is.True);
Assert.That(simpleAction.WasReleasedThisFrame(), Is.True);

//Reset State
InputSystem.settings.updateMode = updateMode;
}

[UnityTest]
[Category("Actions")]
public IEnumerator Actions_WasStateReachedThisFrameAndWasStateReachedThisRenderingFrameCanOperateSimultanously()
{
var updateMode = InputSystem.settings.updateMode;
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsManually;

var gamepad = InputSystem.AddDevice<Gamepad>();
var simpleAction = new InputAction(binding: "<Gamepad>/buttonSouth");
simpleAction.Enable();

Assert.That(simpleAction.WasPerformedThisFrame(), Is.False);
Assert.That(simpleAction.WasPressedThisFrame(), Is.False);
Assert.That(simpleAction.WasReleasedThisFrame(), Is.False);
Assert.That(simpleAction.WasCompletedThisFrame(), Is.False);

PressAndRelease(gamepad.buttonSouth);

yield return null; // InputSystem.Update is not called and the action state does not change

Assert.That(simpleAction.WasPerformedThisFrame(), Is.False);
Assert.That(simpleAction.WasPressedThisFrame(), Is.False);
Assert.That(simpleAction.WasReleasedThisFrame(), Is.False);

InputSystem.Update(); // a manual update happens between two frames, that does not affect the output of the WasXYZThisRenderingFrame but does affect the WasXYZThisFrame

Assert.That(simpleAction.WasPerformedThisFrame(), Is.True);
Assert.That(simpleAction.WasPressedThisFrame(), Is.True);
Assert.That(simpleAction.WasReleasedThisFrame(), Is.True);

yield return null;

Assert.That(simpleAction.WasPerformedThisRenderingFrame(), Is.True);
Assert.That(simpleAction.WasPressedThisRenderingFrame(), Is.True);
Assert.That(simpleAction.WasReleasedThisRenderingFrame(), Is.True);

yield return null;

Assert.That(simpleAction.WasCompletedThisRenderingFrame(), Is.False);

//Reset State
InputSystem.settings.updateMode = updateMode;
}

[Test]
[Category("Actions")]
public void Actions_WhenShortcutsDisabled_AllConflictingActionsTrigger()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.13.1
// version 1.14.0
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
10 changes: 8 additions & 2 deletions Assets/Tests/Samples/RebindingUITests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Collections;
using System.IO;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Samples.RebindUI;
using UnityEngine.InputSystem.UI;
using UnityEngine.TestTools;
using UnityEngine.UI;

public class RebindingUITests : CoreTestsFixture
Expand Down Expand Up @@ -84,9 +86,9 @@ public void Samples_RebindingUI_UpdatesWhenKeyboardLayoutChanges()
}

// https://fogbugz.unity3d.com/f/cases/1271591/
[Test]
[UnityTest]
[Category("Samples")]
public void Samples_RebindingUI_SuppressingEventsDoesNotInterfereWithUIInput()
public IEnumerator Samples_RebindingUI_SuppressingEventsDoesNotInterfereWithUIInput()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ritamerkl Do we have a test that verifies behavior when configured to run input processing on fixed update?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add tests now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added 8332195

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

especially tested the update and frame based comparing in co-dependency to another

{
var keyboard = InputSystem.AddDevice<Keyboard>();

Expand Down Expand Up @@ -135,6 +137,8 @@ public void Samples_RebindingUI_SuppressingEventsDoesNotInterfereWithUIInput()
// UI should be fine with that.
PressAndRelease(keyboard.enterKey);
eventSystem.InvokeUpdate();
yield return null;


Assert.That(rebind.ongoingRebind, Is.Not.Null);
Assert.That(rebind.ongoingRebind.started, Is.True);
Expand All @@ -144,6 +148,7 @@ public void Samples_RebindingUI_SuppressingEventsDoesNotInterfereWithUIInput()

Press(keyboard.bKey);
eventSystem.InvokeUpdate();
yield return null;

Assert.That(rebind.ongoingRebind, Is.Not.Null);
Assert.That(rebind.ongoingRebind.started, Is.True);
Expand All @@ -162,6 +167,7 @@ public void Samples_RebindingUI_SuppressingEventsDoesNotInterfereWithUIInput()
// Start another rebind via "Submit".
PressAndRelease(keyboard.enterKey);
eventSystem.InvokeUpdate();
yield return null;

Assert.That(rebind.ongoingRebind, Is.Not.Null);
Assert.That(rebind.ongoingRebind.started, Is.True);
Expand Down
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ however, it has to be formatted properly to pass verification tests.
- Pinned Touch Samples sample package dependencies to avoid errors with Cinemachine 3.x and Probuilder 6.x. [ISXB-1245](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1245)
- Fixed issue where a binding path is sometimes not saved when chosen from the binding path picker. [ISXB-1221](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1221)
- Fixed an issue where dropdown menu for Path in Input Actions Editor could not be selected from any button position. [ISXB-1309](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1309)
- Fixed an issue where updating the InputSystem outside of the dynamic Update would lead to UI input and navigation events get lost. [ISXB-1313](https://issuetracker.unity3d.com/issues/ui-onclick-events-sometimes-do-not-trigger-when-manual-update-is-utilized-with-input-system)
- Fixed an issue where changing Input System default parameter settings with the editor open would result in changes in the editor. [ISXB-1351](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1351)

## [1.12.0] - 2025-01-15
Expand Down
Loading