@@ -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" ) ;
@@ -5056,6 +5039,125 @@ public void Actions_CanGetSourceControlWhenReadingValueFromCompositePart()
50565039 LogAssert . NoUnexpectedReceived ( ) ;
50575040 }
50585041
5042+ [ Test ]
5043+ [ Category ( "Actions" ) ]
5044+ public void Actions_CanCreateButtonWithOneModifierComposite ( )
5045+ {
5046+ InputSystem . settings . defaultButtonPressPoint = 0.1f ;
5047+
5048+ // Using gamepad so we can use the triggers and make sure
5049+ // that the composite preserves the full button value instead
5050+ // of just going 0 and 1.
5051+ var gamepad = InputSystem . AddDevice < Gamepad > ( ) ;
5052+
5053+ var action = new InputAction ( type : InputActionType . Button ) ;
5054+ action . AddCompositeBinding ( "ButtonWithOneModifier" )
5055+ . With ( "Modifier" , "<Gamepad>/leftTrigger" )
5056+ . With ( "Modifier" , "<Gamepad>/dpad/up" )
5057+ . With ( "Button" , "<Gamepad>/rightTrigger" ) ;
5058+
5059+ action . Enable ( ) ;
5060+
5061+ using ( var trace = new InputActionTrace ( action ) )
5062+ {
5063+ Set ( gamepad . leftTrigger , 0.5f ) ;
5064+ Assert . That ( trace , Is . Empty ) ;
5065+
5066+ Set ( gamepad . rightTrigger , 0.75f ) ;
5067+ Assert . That ( trace ,
5068+ Started ( action , value : 0.75f , control : gamepad . rightTrigger )
5069+ . AndThen ( Performed ( action , value : 0.75f , control : gamepad . rightTrigger ) ) ) ;
5070+
5071+ trace . Clear ( ) ;
5072+
5073+ Set ( gamepad . leftTrigger , 0 ) ;
5074+ Assert . That ( trace ,
5075+ Canceled ( action , value : 0f , control : gamepad . leftTrigger ) ) ;
5076+
5077+ trace . Clear ( ) ;
5078+
5079+ Press ( gamepad . dpad . up ) ;
5080+ Assert . That ( trace ,
5081+ Started ( action , value : 0.75f , control : gamepad . dpad . up )
5082+ . AndThen ( Performed ( action , value : 0.75f , control : gamepad . dpad . up ) ) ) ;
5083+
5084+ trace . Clear ( ) ;
5085+
5086+ Set ( gamepad . rightTrigger , 0 ) ;
5087+ Assert . That ( trace ,
5088+ Canceled ( action , value : 0f , control : gamepad . rightTrigger ) ) ;
5089+
5090+ trace . Clear ( ) ;
5091+
5092+ Release ( gamepad . dpad . up ) ;
5093+ Set ( gamepad . rightTrigger , 0.456f ) ;
5094+
5095+ Assert . That ( trace , Is . Empty ) ;
5096+ }
5097+ }
5098+
5099+ [ Test ]
5100+ [ Category ( "Actions" ) ]
5101+ public void Actions_CanCreateButtonWithTwoModifiersComposite ( )
5102+ {
5103+ InputSystem . settings . defaultButtonPressPoint = 0.1f ;
5104+
5105+ // Using gamepad so we can use the triggers and make sure
5106+ // that the composite preserves the full button value instead
5107+ // of just going 0 and 1.
5108+ var gamepad = InputSystem . AddDevice < Gamepad > ( ) ;
5109+
5110+ var action = new InputAction ( type : InputActionType . Button ) ;
5111+ action . AddCompositeBinding ( "ButtonWithTwoModifiers" )
5112+ . With ( "Modifier1" , "<Gamepad>/leftTrigger" )
5113+ . With ( "Modifier1" , "<Gamepad>/dpad/up" )
5114+ . With ( "Modifier2" , "<Gamepad>/rightTrigger" )
5115+ . With ( "Modifier2" , "<Gamepad>/dpad/down" )
5116+ . With ( "Button" , "<Gamepad>/leftStick/up" ) ;
5117+
5118+ action . Enable ( ) ;
5119+
5120+ using ( var trace = new InputActionTrace ( action ) )
5121+ {
5122+ Set ( gamepad . leftTrigger , 0.345f ) ;
5123+ Assert . That ( trace , Is . Empty ) ;
5124+
5125+ Set ( gamepad . rightTrigger , 0.456f ) ;
5126+ Assert . That ( trace , Is . Empty ) ;
5127+
5128+ Set ( gamepad . leftStick , new Vector2 ( 0 , 0.75f ) ) ;
5129+ Assert . That ( trace ,
5130+ Started ( action ,
5131+ value : 0.75f ,
5132+ control : gamepad . leftStick . up )
5133+ . AndThen ( Performed ( action ,
5134+ value : 0.75f ,
5135+ control : gamepad . leftStick . up ) ) ) ;
5136+
5137+ trace . Clear ( ) ;
5138+
5139+ Press ( gamepad . dpad . up ) ;
5140+ Set ( gamepad . leftTrigger , 0 ) ;
5141+
5142+ // Bit counter-intuitive but the composite yields a value every time
5143+ // one of the constituents change.
5144+ Assert . That ( trace ,
5145+ Performed ( action ,
5146+ value : 0.75f ,
5147+ control : gamepad . dpad . up )
5148+ . AndThen ( Performed ( action ,
5149+ value : 0.75f ,
5150+ control : gamepad . leftTrigger ) ) ) ;
5151+
5152+ trace . Clear ( ) ;
5153+
5154+ Set ( gamepad . rightTrigger , 0 ) ;
5155+
5156+ Assert . That ( trace ,
5157+ Canceled ( action , value : 0f , control : gamepad . rightTrigger ) ) ;
5158+ }
5159+ }
5160+
50595161 [ Test ]
50605162 [ Category ( "Actions" ) ]
50615163 public void Actions_CanSerializeAndDeserializeActionMapsWithCompositeBindings ( )
@@ -5827,8 +5929,6 @@ public void Actions_CanIterateOverActionsInMap()
58275929 [ Category ( "Actions" ) ]
58285930 public void Actions_CanUseTouchWithActions ( )
58295931 {
5830- InputSystem . settings . timesliceEvents = false ;
5831-
58325932 var touchscreen = InputSystem . AddDevice < Touchscreen > ( ) ;
58335933
58345934 var primaryTouchAction = new InputAction ( "PrimaryTouch" , binding : "<Touchscreen>/primaryTouch/position" ) ;
@@ -5899,8 +5999,6 @@ public void Actions_CanUseTouchWithActions()
58995999 [ Category ( "Actions" ) ]
59006000 public void Actions_CanDrivePointerInputFromTouchPenAndMouse ( )
59016001 {
5902- InputSystem . settings . timesliceEvents = false ;
5903-
59046002 // Give us known parameters for tap detection.
59056003 InputSystem . settings . defaultTapTime = 0.5f ;
59066004 InputSystem . settings . tapRadius = 5 ;
0 commit comments