You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Assets/Tests/InputSystem/Plugins/EnhancedTouchTests.cs
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -172,11 +172,11 @@ public void EnhancedTouch_SupportsEditorUpdates(InputSettings.UpdateMode updateM
172
172
// Switch back to player.
173
173
ScheduleFocusEvent(true);
174
174
175
-
// We have to schedule the specific update type that the player is configured to process events in,
176
-
// otherwise we will end up using defaultUpdateType, which due to the fact we do not have focus in pre-update yet,
177
-
// will be Editor, which means that we will end up swapping buffers to the editor buffer, and retreiving the wrong active touch
178
-
// The only way to properly fix this, is to remove defaultUpdateType, and split the player/editor update loops into separate methods, which would be a breaking change.
179
-
// Until then, we have to make sure to schedule the correct update type here.
175
+
// Explicitly schedule the player's configured update type rather than relying on the default.
176
+
// Without explicit scheduling, defaultUpdateType would be Editor (since focus has not yet been
177
+
// gained during update), causing the editor buffer to be used instead of the player buffer,
178
+
// which would retrieve the wrong active touch. A proper fix would require removing defaultUpdateType
179
+
// and splitting player/editor update loops into separate methods.
Copy file name to clipboardExpand all lines: Assets/Tests/InputSystem/Plugins/UserTests.cs
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1268,14 +1268,19 @@ public void Users_DoNotReactToEditorInput()
1268
1268
++InputUser.listenForUnpairedDeviceActivity;
1269
1269
InputUser.onUnpairedDeviceUsed+=(control,eventPtr)=>Assert.Fail("Should not react!");
1270
1270
1271
-
// We now have to run a dynamic update before the press, to make sure the focus state is up to date.
1272
-
// This is due to scheduled focus events are not being processed in pre-update, and not running an update before the press would result in the incorrect state.
1273
-
// When calling an empty Update(), it will use the default defaultUpdateType to determine which update type to use.
1274
-
// However in pre-update the focus will not have switched to false yet if not running a dynamic update before, so the focus check in defaultUpdateType is no longer correct.
1275
-
// which would cause it to schedule a dynamic update instead. We solve this by first processing the focus event before pressing the button,
1276
-
// which will then make it correctly swap to an editor update type when doing the button press.
1277
-
// Another way to make this test pass, is to queue the button press and then explicitly call an editor update and process both events
1278
-
// The way to solve this is to remove defaultUpdateType and split the editor/player loops or to make sure we do not call any Update() without update type, so we do not use defaultUpdateType.
1271
+
// Process the focus event before pressing the button to ensure correct update type selection.
1272
+
//
1273
+
// Issue: When Update() is called without an update type, it uses defaultUpdateType which checks
1274
+
// focus state. However, scheduled focus events aren't processed until an update runs, so the
1275
+
// focus check sees stale state and selects the wrong update type.
1276
+
//
1277
+
// Workaround: Run a dynamic update first to process the focus event, ensuring the subsequent
thrownewAccessViolationException($"'{device}'.PreProcessEvent tries to grow an event from {eventSizeBeforePreProcessor} bytes to {currentEventReadPtr->sizeInBytes} bytes, this will potentially corrupt events after the current event and/or cause out-of-bounds memory access.");
3401
3403
}
3402
-
#endif
3404
+
#endif
3403
3405
if(!shouldProcess)
3404
3406
{
3405
3407
// Skip event if PreProcessEvent considers it to be irrelevant.
0 commit comments