Skip to content

Commit 6e29f4a

Browse files
authored
FIX: ISXB-1013-prevent-ui-update-loop (#1984)
* Improve ui test CanRenameActionMap to take the scheduler in account
1 parent 491372f commit 6e29f4a

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public IEnumerator CanRenameActionMap()
109109
m_Window.rootVisualElement.Q<ListView>("action-maps-list-view").Focus();
110110
m_Window.rootVisualElement.Q<ListView>("action-maps-list-view").selectedIndex = 1;
111111

112+
// changing the selection triggers a state change, wait for the scheduler to process the frame
113+
yield return WaitForSchedulerLoop();
112114
yield return WaitForNotDirty();
113115
yield return WaitForFocus(m_Window.rootVisualElement.Q("action-maps-list-view"));
114116

Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ protected void SimulateDeleteCommand()
120120
m_Window.rootVisualElement.SendEvent(ce);
121121
}
122122

123+
/// <summary>
124+
/// Wait for UI toolkit scheduler to process the frame
125+
/// </summary>
126+
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
127+
protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0)
128+
{
129+
bool done = false;
130+
m_Window.rootVisualElement.schedule.Execute(() => done = true);
131+
return WaitUntil(() => done == true, "WaitForSchedulerLoop", timeoutSecs);
132+
}
133+
123134
/// <summary>
124135
/// Wait for the visual element to be focused
125136
/// </summary>

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ however, it has to be formatted properly to pass verification tests.
1414
- Fixed memory allocation on every frame when using UIDocument without EventSystem. [ISXB-953](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-953)
1515
- Fixed Action Maps name edition which could be inconsistent in Input Action Editor UI.
1616
- Fixed InputDeviceTester sample only visualizing a given touch contact once. [ISXB-1017](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1017)
17+
- Fixed an update loop in the asset editor that occurs when selecting an Action Map that has no Actions.
1718
- Fixed Package compilation when Unity Analytics module is not enabled on 2022.3. [ISXB-996](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-996)
1819

1920
### Added

0 commit comments

Comments
 (0)