Skip to content

Commit 4d0196d

Browse files
committed
Merge branch 'develop' into stable
2 parents 73feff4 + 8714f70 commit 4d0196d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1803
-62
lines changed

.yamato/PVPexemptions.json

+1,588
Large diffs are not rendered by default.

.yamato/upm-ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ publish{% cycle "", "_dryrun" %}:
247247
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
248248
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u 2019.4
249249
- upm-ci package publish --package-path ./Packages/com.unity.inputsystem/ {% cycle "", "--dry-run" %}
250+
- upm-pvp xray --packages "upm-ci~/packages/*.tgz" --results upm-ci~/xray
251+
- upm-pvp require "supported rme" --no-report --allow-missing --results upm-ci~/xray --exemptions upm-ci~/xray/new-exemptions.json
252+
- upm-pvp require "supported rme ./.yamato/PVPexemptions.json" --allow-missing --results upm-ci~/xray
250253
artifacts:
251254
artifacts:
252255
paths:
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Custom Binding Composite",
33
"description": "Shows how to implement a custom composite binding."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Custom Device",
33
"description": "Shows how to implement a custom input device."
4-
}
4+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Custom Device Usages",
33
"description": "Shows how to tag devices with custom usage strings that can be used, for example, to distinguish multiple instances of the same type of device (e.g. 'Gamepad') based on how the device is used (e.g. 'Player1' vs 'Player2' or 'LeftHand' vs 'RightHand')."
4-
}
4+
}

Assets/Samples/CustomDeviceUsages/.sample.json.meta

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Gamepad Mouse Cursor",
33
"description": "An example that shows how to use the gamepad for driving a mouse cursor for use with UIs."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "In-Game Hints",
33
"description": "Demonstrates how to create in-game hints in the UI which reflect current bindings and active control schemes."
4-
}
4+
}

Assets/Samples/InGameHints/InGameHintsActions.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.9.0
4+
// version 1.10.0
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,6 @@
1414
using System.Collections.Generic;
1515
using UnityEngine.InputSystem;
1616
using UnityEngine.InputSystem.Utilities;
17-
using UnityEngine;
1817

1918
namespace UnityEngine.InputSystem.Samples.InGameHints
2019
{
@@ -275,7 +274,7 @@ public @InGameHintsActions()
275274

276275
~@InGameHintsActions()
277276
{
278-
Debug.Assert(!m_Gameplay.enabled, "This will cause a leak and performance issues, InGameHintsActions.Gameplay.Disable() has not been called.");
277+
UnityEngine.Debug.Assert(!m_Gameplay.enabled, "This will cause a leak and performance issues, InGameHintsActions.Gameplay.Disable() has not been called.");
279278
}
280279

281280
public void Dispose()
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "InputDeviceTester",
33
"description": "A scene containing UI to visualize the controls on various supported input devices."
4-
}
4+
}

Assets/Samples/InputDeviceTester/.sample.json.meta

-3
This file was deleted.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Input Recorder",
33
"description": "Shows how to capture and replay input events. Also useful by itself to debug input event sequences."
4-
}
4+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "On-Screen Controls",
33
"description": "Demonstrates a simple setup for an on-screen joystick."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Rebinding UI",
33
"description": "An example UI component that demonstrates how to create UI for rebinding actions."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Simple Demo",
33
"description": "A walkthrough of a simple character controller that demonstrates several techniques for working with the input system. See the README.md file in the sample for details."
4-
}
4+
}

Assets/Samples/SimpleDemo/.sample.json.meta

-3
This file was deleted.

Assets/Samples/SimpleDemo/SimpleControls.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.9.0
4+
// version 1.10.0
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,6 @@
1414
using System.Collections.Generic;
1515
using UnityEngine.InputSystem;
1616
using UnityEngine.InputSystem.Utilities;
17-
using UnityEngine;
1817

1918
public partial class @SimpleControls: IInputActionCollection2, IDisposable
2019
{
@@ -170,7 +169,7 @@ public @SimpleControls()
170169

171170
~@SimpleControls()
172171
{
173-
Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, SimpleControls.gameplay.Disable() has not been called.");
172+
UnityEngine.Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, SimpleControls.gameplay.Disable() has not been called.");
174173
}
175174

176175
public void Dispose()
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Simple Multiplayer",
33
"description": "Demonstrates how to set up a simple local multiplayer scenario."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Touch Samples",
33
"description": "A series of sample scenes for using touch input with the Input System package. This sample is not actually part of the package, but needs to be downloaded."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "UI vs. Game Input",
33
"description": "An example that shows how to deal with ambiguities that may arrise when overlaying interactive UI elements on top of a game scene."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Unity Remote",
33
"description": "An example with a simple scene for trying out the Unity Remote app."
4-
}
4+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"displayName": "Visualizers",
33
"description": "Several example visualizations of input controls/devices and input actions."
4-
}
4+
}

Assets/Tests/InputSystem/CoreTests_Actions.cs

+30
Original file line numberDiff line numberDiff line change
@@ -5250,6 +5250,36 @@ public void Actions_CanAddBindingsToActions_ToExistingComposite()
52505250
composite.InsertPartBinding("Negative", "<Keyboard>/leftArrow");
52515251
composite.InsertPartBinding("Positive", "<Keyboard>/rightArrow");
52525252

5253+
ValidateCompositeBindingsOnAction(action);
5254+
}
5255+
5256+
[Test]
5257+
[Category("Actions")]
5258+
[Description("ISXB-494 Changing composite of action inside a map triggered exception that wasn't caught by previous test.")]
5259+
public void Actions_CanChangeBindingPart_ToExistingCompositeInActionMap()
5260+
{
5261+
var keyboard = InputSystem.AddDevice<Keyboard>();
5262+
5263+
var actionMap = new InputActionMap("Map");
5264+
var action = actionMap.AddAction("Action", InputActionType.Value, expectedControlLayout: "Axis");
5265+
5266+
action.AddCompositeBinding("Axis")
5267+
.With("Negative", "<Keyboard>/a")
5268+
.With("Positive", "<Keyboard>/d");
5269+
5270+
Assert.That(action.bindings, Has.Count.EqualTo(3));
5271+
Assert.That(action.controls, Is.EquivalentTo(new[] { keyboard.aKey, keyboard.dKey }));
5272+
5273+
var composite = action.ChangeCompositeBinding("Axis");
5274+
5275+
composite.InsertPartBinding("Negative", "<Keyboard>/leftArrow");
5276+
composite.InsertPartBinding("Positive", "<Keyboard>/rightArrow");
5277+
5278+
ValidateCompositeBindingsOnAction(action);
5279+
}
5280+
5281+
private void ValidateCompositeBindingsOnAction(InputAction action)
5282+
{
52535283
Assert.That(action.bindings, Has.Count.EqualTo(5));
52545284
Assert.That(action.bindings,
52555285
Has.Exactly(1).With.Property("isComposite").EqualTo(true).And.With.Property("isPartOfComposite").EqualTo(false).And.With

Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs

+42
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,48 @@ public void Actions_WhenTransitioningFromOneInteractionToNext_GetCallbacks()
231231
}
232232
}
233233

234+
// https://jira.unity3d.com/browse/ISXB-310
235+
[Test]
236+
[Category("Actions")]
237+
public void Actions_WhenTransitioningFromOneInteractionToNextAlreadyPerformed_GetCallbacksAndResetOtherInteractions()
238+
{
239+
ResetTime();
240+
241+
var gamepad = InputSystem.AddDevice<Gamepad>();
242+
243+
var action = new InputAction("test", InputActionType.Button, binding: "<Gamepad>/buttonSouth",
244+
interactions: "multiTap(tapCount=3),multiTap,Tap");
245+
action.Enable();
246+
247+
using (var trace = new InputActionTrace(action))
248+
{
249+
// Trigger the second interaction with a double tap which also internally performs a tap on the third one.
250+
PressAndRelease(gamepad.buttonSouth);
251+
PressAndRelease(gamepad.buttonSouth, 0.2);
252+
currentTime = 2;
253+
InputSystem.Update();
254+
Assert.That(trace,
255+
Started<MultiTapInteraction>(action, gamepad.buttonSouth, time: 0)
256+
.AndThen(Canceled<MultiTapInteraction>(action, gamepad.buttonSouth, duration: 2))
257+
.AndThen(Started<MultiTapInteraction>(action, gamepad.buttonSouth))
258+
.AndThen(Performed<MultiTapInteraction>(action, gamepad.buttonSouth, duration: 0.2)));
259+
260+
trace.Clear();
261+
262+
// Trigger the third interaction with a tap and ensure that doesn't come from the previous one.
263+
PressAndRelease(gamepad.buttonSouth, time: 4);
264+
currentTime = 6;
265+
InputSystem.Update();
266+
Assert.That(trace,
267+
Started<MultiTapInteraction>(action, gamepad.buttonSouth, time: 4)
268+
.AndThen(Canceled<MultiTapInteraction>(action, gamepad.buttonSouth, duration: 2))
269+
.AndThen(Started<MultiTapInteraction>(action, gamepad.buttonSouth, time: 4))
270+
.AndThen(Canceled<MultiTapInteraction>(action, gamepad.buttonSouth, duration: 2))
271+
.AndThen(Started<TapInteraction>(action, gamepad.buttonSouth, time: 4))
272+
.AndThen(Performed<TapInteraction>(action, gamepad.buttonSouth, time: 4)));
273+
}
274+
}
275+
234276
[Test]
235277
[Category("Actions")]
236278
public void Actions_CanPerformPressInteraction()

Assets/Tests/InputSystem/InputActionCodeGeneratorActions.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.9.0
4+
// version 1.10.0
55
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,6 @@
1414
using System.Collections.Generic;
1515
using UnityEngine.InputSystem;
1616
using UnityEngine.InputSystem.Utilities;
17-
using UnityEngine;
1817

1918
public partial class @InputActionCodeGeneratorActions: IInputActionCollection2, IDisposable
2019
{
@@ -83,7 +82,7 @@ public @InputActionCodeGeneratorActions()
8382

8483
~@InputActionCodeGeneratorActions()
8584
{
86-
Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, InputActionCodeGeneratorActions.gameplay.Disable() has not been called.");
85+
UnityEngine.Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, InputActionCodeGeneratorActions.gameplay.Disable() has not been called.");
8786
}
8887

8988
public void Dispose()

Assets/Tests/InputSystem/Plugins/UITests.cs

+27-3
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
10371037
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerId, Is.EqualTo(pointerId));
10381038
Assert.That(scene.rightChildReceiver.events[0].pointerData.position, Is.EqualTo(thirdScreenPosition).Using(Vector2EqualityComparer.Instance));
10391039
Assert.That(scene.rightChildReceiver.events[0].pointerData.delta, Is.EqualTo(Vector2.zero));
1040-
Assert.That(scene.rightChildReceiver.events[0].pointerData.scrollDelta, Is.EqualTo(Vector2.one).Using(Vector2EqualityComparer.Instance));
1040+
Assert.That(scene.rightChildReceiver.events[0].pointerData.scrollDelta, Is.EqualTo(Vector2.one * scene.uiModule.scrollDeltaPerTick).Using(Vector2EqualityComparer.Instance));
10411041
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerEnter, Is.SameAs(scene.rightGameObject));
10421042
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerDrag, Is.Null);
10431043
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerPress, Is.Null);
@@ -1201,16 +1201,40 @@ public IEnumerator UI_ReceivesNormalizedScrollWheelDelta(float scrollWheelDeltaP
12011201
Set(mouse.scroll, new Vector2(0, scrollWheelDeltaPerTick));
12021202
yield return null;
12031203

1204-
// UI should receive scroll delta in the [-1, 1] range.
1204+
// UI should receive scroll delta in the range defined by InputSystemUIInputModule.
12051205
Assert.That(scene.leftChildReceiver.events,
12061206
EventSequence(
12071207
OneEvent("type", EventType.Scroll),
12081208
AllEvents("position", scene.From640x480ToScreen(100, 100)),
1209-
AllEvents("scrollDelta", Vector2.up)
1209+
AllEvents("scrollDelta", Vector2.up * scene.uiModule.scrollDeltaPerTick)
12101210
)
12111211
);
12121212
}
12131213

1214+
#endif
1215+
1216+
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA
1217+
[TestCase(1)]
1218+
[TestCase(2)]
1219+
[Category("UI")]
1220+
public void UI_ConvertPointerEventScrollDeltaToTicks_AppliesScrollWheelMultiplier(float multiplier)
1221+
{
1222+
var scene = CreateTestUI();
1223+
scene.uiModule.scrollDeltaPerTick = multiplier;
1224+
var ticks = scene.uiModule.ConvertPointerEventScrollDeltaToTicks(Vector2.one);
1225+
Assert.That(ticks, Is.EqualTo(Vector2.one / multiplier).Within(0.001f));
1226+
}
1227+
1228+
[TestCase(0)]
1229+
[TestCase(1)]
1230+
[Category("UI")]
1231+
public void UI_ConvertPointerEventScrollDeltaToTicks_ReturnsZeroIfScrollDeltaPerTickIsZero(float delta)
1232+
{
1233+
var scene = CreateTestUI();
1234+
scene.uiModule.scrollDeltaPerTick = 0;
1235+
Assert.That(scene.uiModule.ConvertPointerEventScrollDeltaToTicks(Vector2.one * delta), Is.EqualTo(Vector2.zero));
1236+
}
1237+
12141238
#endif
12151239

12161240
[UnityTest]

Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
"name": "Unity",
5151
"expression": "6000.0.9",
5252
"define": "UNITY_INPUT_SYSTEM_PLATFORM_SCROLL_DELTA"
53+
},
54+
{
55+
"name": "Unity",
56+
"expression": "6000.0.11",
57+
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA"
5358
}
5459
],
5560
"noEngineReferences": false

0 commit comments

Comments
 (0)