Skip to content

Commit ffbe357

Browse files
committed
MERGE: develop => stable
2 parents e1f0221 + 7b05865 commit ffbe357

File tree

151 files changed

+2969
-827
lines changed

Some content is hidden

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

151 files changed

+2969
-827
lines changed

.yamato/upm-ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ build_android_{{ editor.version }}_{{ backend.name }}:
108108
name: Build Tests on {{ editor.version }} on android {{ backend.name }}
109109
agent:
110110
type: Unity::VM
111-
image: mobile/android-execution-base:stable
111+
image: mobile/android-package-ci-win:latest
112112
flavor: b1.xlarge
113113
commands:
114114
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
@@ -127,7 +127,7 @@ run_android_{{ editor.version }}_{{ backend.name }}:
127127
name: Run Tests on {{ editor.version }} on android {{ backend.name }}
128128
agent:
129129
type: Unity::mobile::shield
130-
image: mobile/android-execution-base:stable
130+
image: mobile/android-package-ci-win:latest
131131
flavor: b1.medium
132132
# Skip repository cloning
133133
skip_checkout: true
@@ -184,6 +184,8 @@ publish:
184184
type: Unity::VM
185185
image: package-ci/win10:stable
186186
flavor: b1.large
187+
variables:
188+
UPMCI_ENABLE_PACKAGE_SIGNING: 1
187189
commands:
188190
- mv ./Assets/Samples ./Packages/com.unity.inputsystem
189191
- mv ./Assets/Samples.meta ./Packages/com.unity.inputsystem

Assets/Samples/InGameHints/InGameHintsActions.cs

Lines changed: 2 additions & 4 deletions
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.1.1
4+
// version 1.2.0
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if
@@ -17,7 +17,7 @@
1717

1818
namespace UnityEngine.InputSystem.Samples.InGameHints
1919
{
20-
public partial class @InGameHintsActions: IInputActionCollection2, IDisposable
20+
public partial class @InGameHintsActions : IInputActionCollection2, IDisposable
2121
{
2222
public InputActionAsset asset { get; }
2323
public @InGameHintsActions()
@@ -315,14 +315,12 @@ public void Disable()
315315
{
316316
asset.Disable();
317317
}
318-
319318
public IEnumerable<InputBinding> bindings => asset.bindings;
320319

321320
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
322321
{
323322
return asset.FindAction(actionNameOrId, throwIfNotFound);
324323
}
325-
326324
public int FindBinding(InputBinding bindingMask, out InputAction action)
327325
{
328326
return asset.FindBinding(bindingMask, out action);

Assets/Samples/SimpleDemo/SimpleControls.cs

Lines changed: 2 additions & 4 deletions
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.1.1
4+
// version 1.2.0
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if
@@ -15,7 +15,7 @@
1515
using UnityEngine.InputSystem;
1616
using UnityEngine.InputSystem.Utilities;
1717

18-
public partial class @SimpleControls: IInputActionCollection2, IDisposable
18+
public partial class @SimpleControls : IInputActionCollection2, IDisposable
1919
{
2020
public InputActionAsset asset { get; }
2121
public @SimpleControls()
@@ -210,14 +210,12 @@ public void Disable()
210210
{
211211
asset.Disable();
212212
}
213-
214213
public IEnumerable<InputBinding> bindings => asset.bindings;
215214

216215
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
217216
{
218217
return asset.FindAction(actionNameOrId, throwIfNotFound);
219218
}
220-
221219
public int FindBinding(InputBinding bindingMask, out InputAction action)
222220
{
223221
return asset.FindBinding(bindingMask, out action);

Assets/Tests/InputSystem/APIVerificationTests.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,6 @@ public void API_MethodReturnTypesAreNotIntPtr()
156156
Assert.That(intptrMethods, Is.Empty);
157157
}
158158

159-
[Test]
160-
[Category("API")]
161-
[TestCase(typeof(InputControl))]
162-
[TestCase(typeof(IInputInteraction))]
163-
[TestCase(typeof(InputBindingComposite))]
164-
[TestCase(typeof(InputProcessor))]
165-
public void API_TypesCreatedByReflectionHavePreserveAttribute(Type type)
166-
{
167-
var types = type.Assembly.GetTypes().Where(t => type.IsAssignableFrom(t)).Concat(typeof(APIVerificationTests).Assembly.GetTypes().Where(t => type.IsAssignableFrom(t)));
168-
Assert.That(types, Is.Not.Empty);
169-
var typesWithoutPreserveAttribute =
170-
types.Where(t => !t.CustomAttributes.Any(a => a.AttributeType.Name.Contains("PreserveAttribute")))
171-
.Where(t => !IgnoreTypeWithoutPreserveAttribute(t));
172-
Assert.That(typesWithoutPreserveAttribute, Is.Empty);
173-
}
174-
175159
[Test]
176160
[Category("API")]
177161
public void API_MethodParameterTypesAreNotIntPtr()
@@ -427,23 +411,6 @@ private static bool IgnoreMethodForDocs(MethodDefinition method)
427411
return false;
428412
}
429413

430-
private bool IgnoreTypeWithoutPreserveAttribute(Type type)
431-
{
432-
// Precompiled layouts are not created through reflection and thus don't need [Preserve].
433-
if (type == typeof(FastKeyboard)
434-
|| type == typeof(FastMouse)
435-
|| type == typeof(FastTouchscreen)
436-
|| type == typeof(FastDualShock4GamepadHID)
437-
#if UNITY_EDITOR || UNITY_IOS || UNITY_TVOS
438-
// iOS Step Counter is created from C# code
439-
|| type == typeof(iOSStepCounter)
440-
#endif
441-
)
442-
return true;
443-
444-
return false;
445-
}
446-
447414
#if HAVE_DOCTOOLS_INSTALLED
448415
////TODO: move this to a fixture setup so that it runs *once* for all API checks in a test run
449416
private static string GenerateDocsDirectory(out string log)

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,6 @@ public void Actions_WithMultipleBoundControls_DriveInteractionsFromControlWithGr
20962096
}
20972097
}
20982098

2099-
[Preserve]
21002099
private class ReleaseOnlyTestInteraction : IInputInteraction<float>
21012100
{
21022101
private bool m_WaitingForRelease;
@@ -3465,7 +3464,6 @@ public void Actions_IncompatibleProcessorIsIgnored()
34653464
}
34663465

34673466
// ReSharper disable once ClassNeverInstantiated.Local
3468-
[Preserve]
34693467
private class ConstantVector2TestProcessor : InputProcessor<Vector2>
34703468
{
34713469
public override Vector2 Process(Vector2 value, InputControl control)
@@ -3948,7 +3946,6 @@ public void Actions_CanFindEnabledActions()
39483946
}
39493947

39503948
// ReSharper disable once ClassNeverInstantiated.Local
3951-
[Preserve]
39523949
private class TestInteraction : IInputInteraction
39533950
{
39543951
#pragma warning disable CS0649
@@ -6287,7 +6284,6 @@ public void Actions_RegisteringExistingCompositeUnderNewName_CreatesAlias()
62876284
#endif // UNITY_EDITOR
62886285

62896286
#pragma warning disable CS0649
6290-
[Preserve]
62916287
private class CompositeWithParameters : InputBindingComposite<float>
62926288
{
62936289
public int intParameter;
@@ -6868,7 +6864,6 @@ public void Actions_CanCreateComposite_WithPartsBeingOutOfOrder()
68686864
}
68696865
}
68706866

6871-
[Preserve]
68726867
private class LogInteraction : IInputInteraction
68736868
{
68746869
public void Process(ref InputInteractionContext context)
@@ -7254,7 +7249,6 @@ public void Actions_CompositesInDifferentMapsTiedToSameControlsWork()
72547249
LogAssert.NoUnexpectedReceived();
72557250
}
72567251

7257-
[Preserve]
72587252
private class CompositeWithVector2Part : InputBindingComposite<Vector2>
72597253
{
72607254
[InputControlAttribute(layout = "Vector2")]
@@ -7288,7 +7282,6 @@ public void Actions_CanCreateCompositeWithVector2PartBinding()
72887282
}
72897283
}
72907284

7291-
[Preserve]
72927285
private class CompositeAskingForSourceControl : InputBindingComposite<float>
72937286
{
72947287
[InputControl(layout = "Button")]
@@ -8330,28 +8323,27 @@ public void Actions_ExceptionsInCallbacksAreCaughtAndLogged()
83308323
map.actionTriggered += ctx => { throw new InvalidOperationException("TEST EXCEPTION FROM MAP"); };
83318324
action.Enable();
83328325

8326+
LogAssert.Expect(LogType.Exception, new Regex(".*TEST EXCEPTION FROM MAP.*"));
83338327
LogAssert.Expect(LogType.Error,
83348328
new Regex(
83358329
".*InvalidOperationException while executing 'started' callbacks of 'testMap'"));
8336-
LogAssert.Expect(LogType.Exception, new Regex(".*TEST EXCEPTION FROM MAP.*"));
83378330

8331+
LogAssert.Expect(LogType.Exception, new Regex(".*TEST EXCEPTION FROM ACTION.*"));
83388332
LogAssert.Expect(LogType.Error,
83398333
new Regex(
83408334
".*InvalidOperationException while executing 'performed' callbacks of 'testMap/testAction.*'"));
8341-
LogAssert.Expect(LogType.Exception, new Regex(".*TEST EXCEPTION FROM ACTION.*"));
83428335

8336+
LogAssert.Expect(LogType.Exception, new Regex(".*TEST EXCEPTION FROM MAP.*"));
83438337
LogAssert.Expect(LogType.Error,
83448338
new Regex(
83458339
".*InvalidOperationException while executing 'performed' callbacks of 'testMap'"));
8346-
LogAssert.Expect(LogType.Exception, new Regex(".*TEST EXCEPTION FROM MAP.*"));
83478340

83488341
InputSystem.QueueStateEvent(gamepad, new GamepadState().WithButton(GamepadButton.South));
83498342
InputSystem.Update();
83508343

83518344
LogAssert.NoUnexpectedReceived();
83528345
}
83538346

8354-
[Preserve]
83558347
class TestInteractionCheckingDefaultState : IInputInteraction
83568348
{
83578349
public void Process(ref InputInteractionContext context)
@@ -8800,6 +8792,41 @@ public void Actions_CanResetAction()
88008792
}
88018793
}
88028794

8795+
// Corresponds to bug report ticket 1370732.
8796+
[Test]
8797+
[Category("Actions")]
8798+
public void Actions_ResetShouldPreserveEnabledState__IfResetWhileInDisabledState()
8799+
{
8800+
var gamepad = InputSystem.AddDevice<Gamepad>();
8801+
8802+
InputSystem.settings.defaultDeadzoneMin = 0;
8803+
InputSystem.settings.defaultDeadzoneMax = 1;
8804+
8805+
var action = new InputAction(type: InputActionType.Value, binding: "<Gamepad>/leftStick");
8806+
action.Enable();
8807+
Assert.That(action.enabled, Is.True);
8808+
8809+
action.Disable();
8810+
Assert.That(action.enabled, Is.False);
8811+
8812+
action.Reset();
8813+
Assert.That(action.enabled, Is.False);
8814+
8815+
action.Enable();
8816+
Assert.That(action.enabled, Is.True);
8817+
8818+
using (var trace = new InputActionTrace(action))
8819+
{
8820+
Set(gamepad.leftStick, new Vector2(0.2f, 0.3f));
8821+
8822+
Assert.That(action.inProgress, Is.True);
8823+
Assert.That(action.ReadValue<Vector2>(), Is.EqualTo(new Vector2(0.2f, 0.3f)));
8824+
Assert.That(trace,
8825+
Started(action, value: new Vector2(0.2f, 0.3f))
8826+
.AndThen(Performed(action, value: new Vector2(0.2f, 0.3f))));
8827+
}
8828+
}
8829+
88038830
private class MonoBehaviourWithActionProperty : MonoBehaviour
88048831
{
88058832
public InputActionProperty actionProperty;

Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Linq;
22
using NUnit.Framework;
3+
using NUnit.Framework.Constraints;
34
using UnityEngine;
45
using UnityEngine.InputSystem;
56
using UnityEngine.InputSystem.Interactions;
@@ -92,7 +93,6 @@ public void Actions_CanGetCompletionPercentageOfTimeoutOnInteraction()
9293
Assert.That(multiTapAction.GetTimeoutCompletionPercentage(), Is.EqualTo(1).Within(0.0001));
9394
}
9495

95-
[Preserve]
9696
class InteractionThatOnlyPerforms : IInputInteraction<float>
9797
{
9898
// Get rid of unused field warning.
@@ -743,7 +743,6 @@ public void Actions_CanCustomizeButtonPressPointsOfInteractions()
743743
}
744744
}
745745

746-
[Preserve]
747746
private class CancelingTestInteraction : IInputInteraction
748747
{
749748
public void Process(ref InputInteractionContext context)
@@ -795,4 +794,21 @@ public void Actions_ValueIsDefaultWhenActionIsCanceled()
795794
Assert.That(canceledCount, Is.EqualTo(1));
796795
Assert.That(canceledValue, Is.EqualTo(0.0));
797796
}
797+
798+
// https://fogbugz.unity3d.com/f/cases/1354098/
799+
[Test]
800+
[Category("Actions")]
801+
public void Actions_DoesNotThrowWhenDeviceIsDisconnectedWhileControlIsPressed()
802+
{
803+
var gamepad = InputSystem.AddDevice<Gamepad>();
804+
805+
var action = new InputAction("Action",
806+
binding: "<Gamepad>/buttonSouth",
807+
interactions: "Press,Press"); // this bug occurs when there are multiple interactions on a binding
808+
action.Enable();
809+
810+
Press(gamepad.buttonSouth);
811+
812+
Assert.That(() => InputSystem.RemoveDevice(gamepad), Throws.Nothing);
813+
}
798814
}

Assets/Tests/InputSystem/CoreTests_Controls.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,6 @@ public void Controls_CanTurnControlPathIntoHumanReadableText_UsingDisplayNamesFr
11441144
Assert.That(InputControlPath.ToHumanReadableString("<Keyboard>/a", control: Keyboard.current), Is.EqualTo("Q [Keyboard]"));
11451145
}
11461146

1147-
[Preserve]
11481147
private class DeviceWithoutAnyControls : InputDevice
11491148
{
11501149
}

0 commit comments

Comments
 (0)