Skip to content

Commit f105211

Browse files
authored
CHANGE: Removed timesliceEvents (#776)
1 parent 079fc41 commit f105211

File tree

13 files changed

+14
-162
lines changed

13 files changed

+14
-162
lines changed

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ public void Actions_CanDetermineIfMapIsUsableWithGivenDevice()
183183
[Category("Actions")]
184184
public void Actions_WhenDisabled_CancelAllStartedInteractions()
185185
{
186-
InputSystem.settings.timesliceEvents = false;
187-
188186
var gamepad = InputSystem.AddDevice<Gamepad>();
189187

190188
var action1 = new InputAction("action1", InputActionType.Button, binding: "<Gamepad>/buttonSouth", interactions: "Hold");
@@ -828,8 +826,6 @@ public void Actions_CanCreateActionsWithoutAnActionMap()
828826
[Category("Actions")]
829827
public void Actions_CanCreateActionAssetWithMultipleActionMaps()
830828
{
831-
InputSystem.settings.timesliceEvents = false;
832-
833829
var gamepad = InputSystem.AddDevice<Gamepad>();
834830

835831
var asset = ScriptableObject.CreateInstance<InputActionAsset>();
@@ -1172,8 +1168,6 @@ public void Actions_CanByPassControlActuationChecks_UsingPasshtroughAction()
11721168
[Category("Actions")]
11731169
public void Actions_WithMultipleBoundControls_DriveInteractionsFromControlWithGreatestActuation()
11741170
{
1175-
InputSystem.settings.timesliceEvents = false;
1176-
11771171
var gamepad = InputSystem.AddDevice<Gamepad>();
11781172

11791173
// We go through several permutations of the same behavior all in one test. Makes the
@@ -1502,8 +1496,6 @@ public void Actions_WithMultipleBoundControls_CanHandleInteractionsThatTriggerOn
15021496
[Ignore("TODO")]
15031497
public void TODO_Actions_WithMultipleActuationsFromSameState_()
15041498
{
1505-
InputSystem.settings.timesliceEvents = false;
1506-
15071499
var mouse = InputSystem.AddDevice<Mouse>();
15081500
var action = new InputAction(binding: "<Mouse>/*button");
15091501
action.Enable();
@@ -1669,8 +1661,6 @@ public void Actions_WhenTriggered_TriggerGlobalNotification()
16691661
[Category("Actions")]
16701662
public void Actions_CanRecordActions()
16711663
{
1672-
InputSystem.settings.timesliceEvents = false;
1673-
16741664
var action = new InputAction();
16751665
action.AddBinding("<Gamepad>/leftStick");
16761666
action.AddBinding("<Gamepad>/rightStick");
@@ -2588,8 +2578,6 @@ public void Actions_ChangingBindingMaskWhileEnabled_CancelsOngoingActions()
25882578
[Category("Actions")]
25892579
public void Actions_CanAddInteractionsToActions()
25902580
{
2591-
InputSystem.settings.timesliceEvents = false;
2592-
25932581
var gamepad = InputSystem.AddDevice<Gamepad>();
25942582

25952583
InputSystem.RegisterProcessor<ConstantVector2TestProcessor>();
@@ -2980,7 +2968,6 @@ public void Actions_WithoutInteraction_TriggerInResponseToMagnitude()
29802968
[Category("Actions")]
29812969
public void Actions_CanPerformHoldOnTrigger()
29822970
{
2983-
InputSystem.settings.timesliceEvents = false;
29842971
InputSystem.settings.defaultButtonPressPoint = 0.1f;
29852972

29862973
var gamepad = InputSystem.AddDevice<Gamepad>();
@@ -3025,8 +3012,6 @@ public void Actions_CanPerformHoldOnTrigger()
30253012
[Category("Actions")]
30263013
public void Actions_CanDistinguishTapAndSlowTapOnSameAction()
30273014
{
3028-
InputSystem.settings.timesliceEvents = false;
3029-
30303015
// Bindings can have more than one interaction. Depending on the interaction happening on the bound
30313016
// controls one of the interactions may initiate a phase shift and which interaction initiated the
30323017
// shift is visible on the callback.
@@ -3399,8 +3384,6 @@ public void TODO_Actions_ButtonTriggersActionOnlyAfterCrossingPressThreshold()
33993384
[Category("Actions")]
34003385
public void Actions_CanQueryStartAndPerformTime()
34013386
{
3402-
InputSystem.settings.timesliceEvents = false;
3403-
34043387
var gamepad = InputSystem.AddDevice("Gamepad");
34053388

34063389
var action = new InputAction(binding: "/gamepad/leftTrigger", interactions: "slowTap");
@@ -5946,8 +5929,6 @@ public void Actions_CanIterateOverActionsInMap()
59465929
[Category("Actions")]
59475930
public void Actions_CanUseTouchWithActions()
59485931
{
5949-
InputSystem.settings.timesliceEvents = false;
5950-
59515932
var touchscreen = InputSystem.AddDevice<Touchscreen>();
59525933

59535934
var primaryTouchAction = new InputAction("PrimaryTouch" , binding: "<Touchscreen>/primaryTouch/position");
@@ -6018,8 +5999,6 @@ public void Actions_CanUseTouchWithActions()
60185999
[Category("Actions")]
60196000
public void Actions_CanDrivePointerInputFromTouchPenAndMouse()
60206001
{
6021-
InputSystem.settings.timesliceEvents = false;
6022-
60236002
// Give us known parameters for tap detection.
60246003
InputSystem.settings.defaultTapTime = 0.5f;
60256004
InputSystem.settings.tapRadius = 5;

Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ public void Actions_CanPerformPressInteraction()
143143
[Category("Actions")]
144144
public void Actions_CanPerformHoldInteraction()
145145
{
146-
InputSystem.settings.timesliceEvents = false;
147-
148146
const int timeOffset = 123;
149147
runtime.currentTimeOffsetToRealtimeSinceStartup = timeOffset;
150148
runtime.currentTime = 10 + timeOffset;
@@ -256,8 +254,6 @@ public void Actions_CanPerformHoldInteraction()
256254
[Category("Actions")]
257255
public void Actions_CanPerformTapInteraction()
258256
{
259-
InputSystem.settings.timesliceEvents = false;
260-
261257
var gamepad = InputSystem.AddDevice<Gamepad>();
262258

263259
var performedReceivedCalls = 0;
@@ -315,8 +311,6 @@ public void Actions_CanPerformTapInteraction()
315311
[Category("Actions")]
316312
public void Actions_CanPerformDoubleTapInteraction()
317313
{
318-
InputSystem.settings.timesliceEvents = false;
319-
320314
var gamepad = InputSystem.AddDevice<Gamepad>();
321315

322316
runtime.advanceTimeEachDynamicUpdate = 0;

Assets/Tests/InputSystem/CoreTests_Controls.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,14 +574,15 @@ public void Controls_CanQueueValueChange()
574574
[Category("Controls")]
575575
public void Controls_CanQueueValueChange_InFuture()
576576
{
577+
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsInFixedUpdate;
577578
var gamepad = InputSystem.AddDevice<Gamepad>();
578579

579580
gamepad.leftTrigger.QueueValueChange(0.123f, 0.5);
580581

581582
InputSystem.Update();
582583
Assert.That(gamepad.leftTrigger.ReadValue(), Is.EqualTo(0).Within(0.00001));
583584

584-
runtime.currentTime = 1;
585+
runtime.currentTimeForFixedUpdate = 1;
585586
InputSystem.Update();
586587
Assert.That(gamepad.leftTrigger.ReadValue(), Is.EqualTo(0.123).Within(0.00001));
587588
}

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,8 +1308,6 @@ public void TODO_Devices_WhenRemovedThroughEvent_AreReusedWhenReconnectedAndNotR
13081308
[Category("Devices")]
13091309
public void Devices_WhenRemoved_DoNotEmergeOnUnsupportedList()
13101310
{
1311-
InputSystem.settings.timesliceEvents = false;
1312-
13131311
// Devices added directly via AddDevice() don't end up on the list of
13141312
// available devices. Devices reported by the runtime do.
13151313
runtime.ReportNewInputDevice(@"
@@ -1821,8 +1819,6 @@ public void Devices_CanCreateGenericJoystick()
18211819
[Category("Devices")]
18221820
public void Devices_PointerDeltasDoNotAccumulateFromPreviousFrame()
18231821
{
1824-
InputSystem.settings.timesliceEvents = false;
1825-
18261822
var pointer = InputSystem.AddDevice<Pointer>();
18271823

18281824
InputSystem.QueueStateEvent(pointer, new PointerState { delta = new Vector2(0.5f, 0.5f) });
@@ -2201,8 +2197,6 @@ public void Devices_CanUsePenAsPointer()
22012197
[Category("Devices")]
22022198
public void Devices_CanUseTouchscreenAsPointer()
22032199
{
2204-
InputSystem.settings.timesliceEvents = false;
2205-
22062200
var device = InputSystem.AddDevice<Touchscreen>();
22072201

22082202
// First finger goes down.
@@ -2416,8 +2410,6 @@ public void Devices_TouchesDoNotBecomeStationaryWhenNotMovedInFrame()
24162410
[Category("Devices")]
24172411
public void Devices_CanGetStartTimeOfTouches()
24182412
{
2419-
InputSystem.settings.timesliceEvents = false;
2420-
24212413
var touchscreen = InputSystem.AddDevice<Touchscreen>();
24222414

24232415
BeginTouch(4, new Vector2(0.123f, 0.234f), time: 0.1);
@@ -2444,8 +2436,6 @@ public void Devices_CanGetStartTimeOfTouches()
24442436
[Category("Devices")]
24452437
public void Devices_CanDetectTouchTaps()
24462438
{
2447-
InputSystem.settings.timesliceEvents = false;
2448-
24492439
// Give us known tap settings.
24502440
InputSystem.settings.defaultTapTime = 0.5f;
24512441
InputSystem.settings.tapRadius = 5;
@@ -2539,8 +2529,6 @@ public void Devices_CanDetectTouchTaps()
25392529
[Category("Devices")]
25402530
public void Devices_CanDetectTouchTaps_AndKeepTrackOfTapCounts()
25412531
{
2542-
InputSystem.settings.timesliceEvents = false;
2543-
25442532
// Give us known tap settings.
25452533
InputSystem.settings.defaultTapTime = 0.5f;
25462534
InputSystem.settings.tapRadius = 5;
@@ -2666,8 +2654,6 @@ public void Devices_CanReadTouchStateFromTouchControl()
26662654
[Category("Devices")]
26672655
public void Devices_TouchTimestampsFromDifferentIdsDontAffectEachOther()
26682656
{
2669-
InputSystem.settings.timesliceEvents = false;
2670-
26712657
// On iOS and probably Android, when you're touching the screen with two fingers. Touches with different ids can come in different order.
26722658
// Here's an example, in what order OS sends us touches
26732659
// NewInput: Touch Moved 2227.000000 x 1214.000000, id = 5, time = 24.478610

Assets/Tests/InputSystem/CoreTests_Events.cs

Lines changed: 8 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ public void Events_UseCurrentTimeByDefault()
186186
[Category("Events")]
187187
public void Events_CanSwitchToFullyManualUpdates()
188188
{
189-
InputSystem.settings.timesliceEvents = false;
190-
191189
var mouse = InputSystem.AddDevice<Mouse>();
192190

193191
var receivedOnChange = true;
@@ -216,8 +214,6 @@ public void Events_CanSwitchToFullyManualUpdates()
216214
[Category("Events")]
217215
public void Events_CanSwitchToProcessingInFixedUpdates()
218216
{
219-
InputSystem.settings.timesliceEvents = false;
220-
221217
var mouse = InputSystem.AddDevice<Mouse>();
222218

223219
var receivedOnChange = true;
@@ -231,6 +227,7 @@ public void Events_CanSwitchToProcessingInFixedUpdates()
231227
Assert.That(InputSystem.s_Manager.updateMask & InputUpdateType.Dynamic, Is.EqualTo(InputUpdateType.None));
232228

233229
InputSystem.QueueStateEvent(mouse, new MouseState().WithButton(MouseButton.Left));
230+
runtime.currentTimeForFixedUpdate += Time.fixedDeltaTime;
234231
InputSystem.Update(InputUpdateType.Fixed);
235232

236233
Assert.That(mouse.leftButton.isPressed, Is.True);
@@ -277,9 +274,9 @@ public unsafe void Events_AreTimeslicedByDefault()
277274
(eventPtr, _) => receivedEvents.Add(*eventPtr.data);
278275

279276
// First fixed update should just take everything.
280-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.1234f }, 1);
281-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.2345f }, 2);
282-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.3456f }, 2.9);
277+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.1234f}, 1);
278+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.2345f}, 2);
279+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.3456f}, 2.9);
283280

284281
runtime.currentTimeForFixedUpdate = 3;
285282

@@ -298,10 +295,10 @@ public unsafe void Events_AreTimeslicedByDefault()
298295
runtime.currentTimeForFixedUpdate += 1 / 60.0f;
299296

300297
// From now on, fixed updates should only take what falls in their slice.
301-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.1234f }, 3 + 0.001);
302-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.2345f }, 3 + 0.002);
303-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.3456f }, 3 + 1.0 / 60 + 0.001);
304-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.4567f }, 3 + 2 * (1.0 / 60) + 0.001);
298+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.1234f}, 3 + 0.001);
299+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.2345f}, 3 + 0.002);
300+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.3456f}, 3 + 1.0 / 60 + 0.001);
301+
InputSystem.QueueStateEvent(gamepad, new GamepadState {leftTrigger = 0.4567f}, 3 + 2 * (1.0 / 60) + 0.001);
305302

306303
InputSystem.Update(InputUpdateType.Fixed);
307304

@@ -348,49 +345,6 @@ public unsafe void Events_AreTimeslicedByDefault()
348345
Assert.That(InputUpdate.s_LastUpdateRetainedEventCount, Is.Zero);
349346
}
350347

351-
[Test]
352-
[Category("Events")]
353-
public unsafe void Events_TimeslicingCanBeTurnedOff()
354-
{
355-
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsInFixedUpdate;
356-
InputSystem.settings.timesliceEvents = true;
357-
358-
// Get first update out of the way with timeslicing on. First fixed update will consume all
359-
// input so we can't really tell the difference.
360-
InputSystem.Update(InputUpdateType.Fixed);
361-
362-
var gamepad = InputSystem.AddDevice<Gamepad>();
363-
364-
var receivedEvents = new List<InputEvent>();
365-
InputSystem.onEvent +=
366-
(eventPtr, _) => receivedEvents.Add(*eventPtr.data);
367-
368-
bool? receivedOnSettingsChange = null;
369-
InputSystem.onSettingsChange += () => receivedOnSettingsChange = true;
370-
371-
runtime.currentTime = 3;
372-
373-
InputSystem.settings.timesliceEvents = false;
374-
375-
Assert.That(receivedOnSettingsChange, Is.True);
376-
377-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.1234f }, 3 + 0.001);
378-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.2345f }, 3 + 0.002);
379-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.3456f }, 3 + 1.0 / 60 + 0.001);
380-
InputSystem.QueueStateEvent(gamepad, new GamepadState { leftTrigger = 0.4567f }, 3 + 2 * (1.0 / 60) + 0.001);
381-
382-
InputSystem.Update(InputUpdateType.Fixed);
383-
384-
Assert.That(receivedEvents, Has.Count.EqualTo(4));
385-
Assert.That(receivedEvents[0].time, Is.EqualTo(3 + 0.001).Within(0.00001));
386-
Assert.That(receivedEvents[1].time, Is.EqualTo(3 + 0.002).Within(0.00001));
387-
Assert.That(receivedEvents[2].time, Is.EqualTo(3 + 1.0 / 60 + 0.001).Within(0.00001));
388-
Assert.That(receivedEvents[3].time, Is.EqualTo(3 + 2 * (1.0 / 60) + 0.001).Within(0.00001));
389-
Assert.That(gamepad.leftTrigger.ReadValue(), Is.EqualTo(0.4567).Within(0.00001));
390-
391-
Assert.That(InputUpdate.s_LastUpdateRetainedEventCount, Is.Zero);
392-
}
393-
394348
[Test]
395349
[Category("Events")]
396350
public void Events_CanGetAverageEventLag()
@@ -471,8 +425,6 @@ public void Events_CanCreateDeltaStateEventFromControl()
471425
[Category("Events")]
472426
public void Events_SendingStateToDeviceWithoutBeforeRenderEnabled_DoesNothingInBeforeRenderUpdate()
473427
{
474-
InputSystem.settings.timesliceEvents = false;
475-
476428
// We need one device that has before-render updates enabled for the update to enable
477429
// at all.
478430
const string deviceJson = @"
@@ -499,8 +451,6 @@ public void Events_SendingStateToDeviceWithoutBeforeRenderEnabled_DoesNothingInB
499451
[Category("Events")]
500452
public void Events_SendingStateToDeviceWithBeforeRenderEnabled_UpdatesDeviceInBeforeRender()
501453
{
502-
InputSystem.settings.timesliceEvents = false;
503-
504454
const string deviceJson = @"
505455
{
506456
""name"" : ""CustomGamepad"",
@@ -556,8 +506,6 @@ public void TODO_Events_CanFindActiveControlsFromStateEvent()
556506
[Category("Events")]
557507
public void Events_AreProcessedInOrderTheyAreQueuedIn()
558508
{
559-
InputSystem.settings.timesliceEvents = false;
560-
561509
const double kFirstTime = 0.5;
562510
const double kSecondTime = 1.5;
563511
const double kThirdTime = 2.5;
@@ -597,8 +545,6 @@ public void Events_AreProcessedInOrderTheyAreQueuedIn()
597545
[Category("Events")]
598546
public void Events_CanQueueAndReceiveEventsAgainstNonExistingDevices()
599547
{
600-
InputSystem.settings.timesliceEvents = false;
601-
602548
// Device IDs are looked up only *after* the system shows the event to us.
603549

604550
var receivedCalls = 0;
@@ -623,8 +569,6 @@ public void Events_CanQueueAndReceiveEventsAgainstNonExistingDevices()
623569
[Category("Events")]
624570
public void Events_HandledFlagIsResetWhenEventIsQueued()
625571
{
626-
InputSystem.settings.timesliceEvents = false;
627-
628572
var receivedCalls = 0;
629573
var wasHandled = true;
630574

@@ -722,8 +666,6 @@ public unsafe void Events_CanHandleStateNotAlignedTo4ByteBoundary()
722666
[Category("Events")]
723667
public unsafe void Events_CanTraceEventsOfDevice()
724668
{
725-
InputSystem.settings.timesliceEvents = false;
726-
727669
var device = InputSystem.AddDevice<Gamepad>();
728670
var noise = InputSystem.AddDevice<Gamepad>();
729671

@@ -767,8 +709,6 @@ public unsafe void Events_CanTraceEventsOfDevice()
767709
[Category("Events")]
768710
public void Events_WhenTraceIsFull_WillStartOverwritingOldEvents()
769711
{
770-
InputSystem.settings.timesliceEvents = false;
771-
772712
var device = InputSystem.AddDevice<Gamepad>();
773713
using (var trace =
774714
new InputEventTrace(StateEvent.GetEventSizeWithPayload<GamepadState>() * 2) {deviceId = device.id})
@@ -848,8 +788,6 @@ public void Events_GetUniqueIds()
848788
[Category("Events")]
849789
public void Events_IfOldStateEventIsSentToDevice_IsIgnored()
850790
{
851-
InputSystem.settings.timesliceEvents = false;
852-
853791
var gamepad = InputSystem.AddDevice<Gamepad>();
854792

855793
InputSystem.QueueStateEvent(gamepad, new GamepadState {rightTrigger = 0.5f}, 2.0);
@@ -870,8 +808,6 @@ public void Events_IfOldStateEventIsSentToDevice_IsIgnored()
870808
[Category("Events")]
871809
public void Events_IfOldStateEventIsSentToDevice_IsIgnored_ExceptIfEventIsHandledByIInputStateCallbackReceiver()
872810
{
873-
InputSystem.settings.timesliceEvents = false;
874-
875811
var device = InputSystem.AddDevice<Touchscreen>();
876812

877813
// Sanity check.

0 commit comments

Comments
 (0)