Skip to content

Commit aa990fd

Browse files
authored
Merge branch 'develop' into isxb-1155-disable-rename-cut-mode
2 parents 88aded7 + 52185c4 commit aa990fd

19 files changed

+363
-136
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ Tools/CI/[Oo]bj
4949
.Editor
5050
.bin
5151
.download
52+
53+
!Tools/CI/InputSystem.Cookbook.csproj
54+
!Tools/CI/InputSystem-recipes.sln

.yamato/upm-ci.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
flavor: {{ platform.flavor }}
1313
variables:
1414
EDITOR_VERSION: {{ editor.version }}
15-
commands:
15+
commands:
1616
- {{ utr_install_win }}
1717
- {{ upm_ci_install }}
1818
# Get version 2.3.0-preview of doctools package (it currently fails for 3.0.0-preview).
@@ -26,7 +26,7 @@
2626
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
2727
# Run upm-ci verification tests as well as tests contained in the package.
2828
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u %EDITOR_VERSION%
29-
{% if platform.name == "win" %} --enable-code-coverage --code-coverage-options "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem"
29+
{% if platform.name == "win" %} --enable-code-coverage --code-coverage-options "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem;pathReplacePatterns:@*,,Library/PackageCache,Packages"
3030
--extra-utr-arg="--coverage-results-path={{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Package" {% endif %}
3131
{% if platform.installscript %}
3232
- {{ unity_downloader_install }}
@@ -38,6 +38,13 @@
3838
- move /Y .\Packages\com.unity.inputsystem\Samples.meta .\Assets
3939
# Now run our full test suite that sits in Assets/Tests by running UTR on our project.
4040
- ./utr --testproject . --timeout=1200 --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode {% if platform.name == "win" %} --suite=editor {% endif %} {% if category.name == "performance" %} --category=Performance {% endif %} --api-profile=NET_4_6 {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %} --report-performance-data --performance-project-id=InputSystem {% if platform.name == "win" %}--enable-code-coverage --coverage-options="generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --coverage-results-path={{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Project {% endif %}
41+
# Merge all the code coverage results into one report.
42+
{% if platform.name == "win" %}
43+
- '{{ yamato_source_dir_win }}/.Editor/Unity.exe -projectPath {{ yamato_source_dir_win }} -batchmode -debugCodeOptimization -enableCodeCoverage -coverageResultsPath {{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/ -coverageOptions "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem;sourcePaths:{{ yamato_source_dir_win }}/Packages/com.unity.inputsystem/" -quit'
44+
#delete the reports from the two runs and only keep the final merged one
45+
- rmdir /s/q "{{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Package"
46+
- rmdir /s/q "{{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Project"
47+
{% endif %}
4148
after:
4249
- {{ instabilities_install_win }}
4350
- {{ instabilities_run_win }}
@@ -70,7 +77,7 @@
7077
- mv ./Assets/Samples.meta ./Packages/com.unity.inputsystem
7178
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
7279
# Run upm-ci verification tests as well as tests contained in the package.
73-
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u $EDITOR_VERSION {% if platform.name == "mac" or platform.name == "linux" %} --enable-code-coverage --code-coverage-options "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --extra-utr-arg="--coverage-results-path={{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Package" {% endif %}
80+
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u $EDITOR_VERSION {% if platform.name == "mac" or platform.name == "linux" %} --enable-code-coverage --code-coverage-options "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem;pathReplacePatterns:@*,,Library/PackageCache,Packages" --extra-utr-arg="--coverage-results-path={{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Package" {% endif %}
7481
{% if platform.installscript %}
7582
- {{ unity_downloader_install }}
7683
- {{ platform.installscript }} $EDITOR_VERSION
@@ -81,6 +88,15 @@
8188
- mv ./Packages/com.unity.inputsystem/Samples.meta ./Assets
8289
# Now run our full test suite that sits in Assets/Tests by running UTR on our project.
8390
- ./utr --testproject . --timeout=1200 --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode {% if platform.name == "mac" or platform.name == "linux"%} --suite=editor {% endif %} {% if category.name == "performance" %} --category=Performance {% endif %} --api-profile=NET_4_6 {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %} --report-performance-data --performance-project-id=InputSystem {% if platform.name == "mac" or platform.name == "linux" %} --enable-code-coverage --coverage-options="generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --coverage-results-path={{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Project {% endif %}
91+
# Merge all the code coverage results into one report.
92+
{% if platform.name == "mac" %}
93+
- '{{ yamato_source_dir_nix }}/.Editor/Unity.app/Contents/MacOS/Unity -projectPath {{ yamato_source_dir_nix }} -batchmode -debugCodeOptimization -enableCodeCoverage -coverageResultsPath {{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/ -coverageOptions "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem;sourcePaths:{{ yamato_source_dir_nix }}/Packages/com.unity.inputsystem/" -quit'
94+
{% endif %}
95+
{% if platform.name == "linux" %}
96+
- '{{ yamato_source_dir_nix }}/.Editor/Unity -projectPath {{ yamato_source_dir_nix }} -batchmode -debugCodeOptimization -enableCodeCoverage -coverageResultsPath {{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/ -coverageOptions "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem;sourcePaths:{{ yamato_source_dir_nix }}/Packages/com.unity.inputsystem/" -quit'
97+
{% endif %}
98+
- rm -rf {{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Package
99+
- rm -rf {{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Project
84100
after:
85101
- {{ instabilities_install_nix }}
86102
- {{ platform.instabilities_run }}

Assets/Tests/InputSystem/Plugins/OnScreenTests.cs

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public void Devices_DisablingLastOnScreenControlDoesReportActiveControl()
395395
// https://fogbugz.unity3d.com/f/cases/1271942
396396
[UnityTest]
397397
[Category("Devices")]
398-
public IEnumerator Devices_CanHaveOnScreenJoystickControls()
398+
public IEnumerator Devices_CanHaveOnScreenJoystickControls([Values(false, true)] bool useInIsolation)
399399
{
400400
foreach (var c in Camera.allCameras)
401401
Object.Destroy(c.gameObject);
@@ -422,18 +422,33 @@ public IEnumerator Devices_CanHaveOnScreenJoystickControls()
422422
canvasGO.AddComponent<GraphicRaycaster>();
423423
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
424424

425-
var stickGO = new GameObject("Stick");
426-
stickGO.SetActive(false);
427-
var stickTransform = stickGO.AddComponent<RectTransform>();
428-
var stick = stickGO.AddComponent<OnScreenStick>();
429-
stickGO.AddComponent<Image>();
430-
stickTransform.SetParent(canvasTransform);
431-
stickTransform.anchorMin = new Vector2(0, 0);
432-
stickTransform.anchorMax = new Vector2(0, 0);
433-
stickTransform.anchoredPosition = new Vector2(100, 100);
434-
stickTransform.sizeDelta = new Vector2(100, 100);
435-
stick.controlPath = "<Gamepad>/leftStick";
436-
stickGO.SetActive(true);
425+
var stickLeftGO = new GameObject("StickLeft");
426+
stickLeftGO.SetActive(false);
427+
var stickLeftTransform = stickLeftGO.AddComponent<RectTransform>();
428+
var stickLeft = stickLeftGO.AddComponent<OnScreenStick>();
429+
stickLeft.useIsolatedInputActions = useInIsolation;
430+
stickLeftGO.AddComponent<Image>();
431+
stickLeftTransform.SetParent(canvasTransform);
432+
stickLeftTransform.anchorMin = new Vector2(0, 0);
433+
stickLeftTransform.anchorMax = new Vector2(0, 0);
434+
stickLeftTransform.anchoredPosition = new Vector2(100, 100);
435+
stickLeftTransform.sizeDelta = new Vector2(100, 100);
436+
stickLeft.controlPath = "<Gamepad>/leftStick";
437+
stickLeftGO.SetActive(true);
438+
439+
var stickRightGO = new GameObject("StickRight");
440+
stickRightGO.SetActive(false);
441+
var stickRightTransform = stickRightGO.AddComponent<RectTransform>();
442+
var stickRight = stickRightGO.AddComponent<OnScreenStick>();
443+
stickRight.useIsolatedInputActions = useInIsolation;
444+
stickRightGO.AddComponent<Image>();
445+
stickRightTransform.SetParent(canvasTransform);
446+
stickRightTransform.anchorMin = new Vector2(0, 0);
447+
stickRightTransform.anchorMax = new Vector2(0, 0);
448+
stickRightTransform.anchoredPosition = new Vector2(500, 100);
449+
stickRightTransform.sizeDelta = new Vector2(100, 100);
450+
stickRight.controlPath = "<Gamepad>/rightStick";
451+
stickRightGO.SetActive(true);
437452

438453
var buttonGO = new GameObject("Button");
439454
buttonGO.SetActive(false);
@@ -464,7 +479,7 @@ public IEnumerator Devices_CanHaveOnScreenJoystickControls()
464479

465480
Assert.That(player.devices, Is.EquivalentTo(new[] { Gamepad.all[0] }));
466481

467-
// Touch the stick and drag it upwards.
482+
// Touch the Left stick and drag it upwards.
468483
BeginTouch(1, new Vector2(150, 150));
469484
yield return null;
470485
eventSystem.Update();
@@ -491,6 +506,38 @@ public IEnumerator Devices_CanHaveOnScreenJoystickControls()
491506
InputSystem.Update(); // Button is feeding events when responding to UI events.
492507

493508
Assert.That(Gamepad.all[0].buttonSouth.isPressed, Is.False);
509+
510+
// Touch the right stick and drag it downwards
511+
BeginTouch(2, new Vector2(550, 150));
512+
yield return null;
513+
eventSystem.Update();
514+
Assert.That(eventSystem.IsPointerOverGameObject(), Is.True);
515+
MoveTouch(2, new Vector2(550, 50));
516+
yield return null;
517+
eventSystem.Update();
518+
InputSystem.Update(); // Stick is feeding events when responding to UI events.
519+
520+
Assert.That(Gamepad.all[0].leftStick.ReadValue(), Is.EqualTo(new Vector2(0, 1)).Using(Vector2EqualityComparer.Instance));
521+
Assert.That(Gamepad.all[0].rightStick.ReadValue(), Is.EqualTo(new Vector2(0, -1)).Using(Vector2EqualityComparer.Instance));
522+
523+
// Release finger one and move second and ensure that it still works
524+
EndTouch(1, new Vector2(550, 200));
525+
MoveTouch(2, new Vector2(600, 150));
526+
yield return null;
527+
eventSystem.Update();
528+
InputSystem.Update(); // Stick is feeding events when responding to UI events.
529+
530+
Assert.That(Gamepad.all[0].leftStick.ReadValue(), Is.EqualTo(new Vector2(0, 0)).Using(Vector2EqualityComparer.Instance));
531+
Assert.That(Gamepad.all[0].rightStick.ReadValue(), Is.EqualTo(new Vector2(1, 0)).Using(Vector2EqualityComparer.Instance));
532+
533+
// Release finger two
534+
EndTouch(2, new Vector2(600, 150));
535+
yield return null;
536+
eventSystem.Update();
537+
InputSystem.Update(); // Stick is feeding events when responding to UI events.
538+
539+
Assert.That(Gamepad.all[0].leftStick.ReadValue(), Is.EqualTo(new Vector2(0, 0)).Using(Vector2EqualityComparer.Instance));
540+
Assert.That(Gamepad.all[0].rightStick.ReadValue(), Is.EqualTo(new Vector2(0, 0)).Using(Vector2EqualityComparer.Instance));
494541
}
495542

496543
[UnityTest]
@@ -519,6 +566,9 @@ public IEnumerator Devices_OnScreenStickDoesNotReceivePointerUpEventsInIsolatedM
519566
uiTestScene.uiInputModule.actionsAsset.actionMaps[0].LazyResolveBindings(true);
520567
};
521568

569+
// Ensure that the OnScreenStick component has been started
570+
yield return null;
571+
522572
yield return uiTestScene.PressAndDrag(image, new Vector2(50, 50));
523573

524574
// The OnScreenStick when being driven from the UI (non-isolated mode) queues the events into the next

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ however, it has to be formatted properly to pass verification tests.
3434
- Fixed an issue with default device selection when adding new Control Scheme.
3535
- Fixed an issue where action map delegates were not updated when the asset already assigned to the PlayerInput component were changed [ISXB-711](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-711).
3636
- Fixed Action properties edition in the UI Toolkit version of the Input Actions Asset editor. [ISXB-1277](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1277)
37+
- Fixed an editor crash caused by input debugger device state window reusing cached state when reconnecting Stadia controller. [ISXB-658](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-658)
3738
- Fixed an issue where batch jobs would fail with "Error: Error building Player because scripts are compiling" if a source generated .inputactions asset is out of sync with its generated source code (ISXB-1300).
39+
- Fixed multiple `OnScreenStick` Components that does not work together when using them simultaneously in isolation mode. [ISXB-813](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-813)
40+
- Fixed an issue in input actions editor window that caused certain fields in custom input composite bindings to require multiple clicks to action / focus. [ISXB-1171](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1171)
41+
- Fixed an editor/player hang in `InputSystemUIInputModule` due to an infinite loop. This was caused by the assumption that `RemovePointerAtIndex` would _always_ successfully remove the pointer, which is not the case with touch based pointers. [ISXB-1258](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1258)
3842
- Fixed Cut Mode for Action Maps and Actions to make renaming disabled. [ISXB-1155](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1155)
3943

4044
### Changed
45+
- Changed location of the link xml file (code stripping rules), from a temporary directory to the project Library folder (ISX-2140).
4146
- Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086).
4247
- Changed `OnScreenControl` to automaticaly switch, in Single Player with autoswitch enabled, to the target device control scheme when the first component is enabled to prevent bad interactions when it start.
4348
- Changed paremeter `overrideModifiersNeedToBePressedFirst` to obsolete for `ButtonWithOneModifier`, `ButtonWithTwoModifiers`, `OneModifierComposite` and `TwoModifiersComposite` in favour the new `modifiersOrder` parameter which is more explicit.
@@ -46,6 +51,7 @@ however, it has to be formatted properly to pass verification tests.
4651
### Added
4752
- Added new API `InputSystem.settings.useIMGUIEditorForAssets` that should be used in custom `InputParameterEditor` that use both IMGUI and UI Toolkit.
4853
- Added ProfilerMakers to `InputAction.Enable()` and `InputActionMap.ResolveBindings()` to enable gathering of profiling data.
54+
- Added throwing an error message when trying to use the Input System package on console without the extension package installed.
4955

5056
## [1.11.2] - 2024-10-16
5157

Packages/com.unity.inputsystem/InputSystem/Editor/BuildPipeline/LinkFileGenerator.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ public string GenerateAdditionalLinkXmlFile(BuildReport report, UnityLinkerBuild
7777

7878
sb.AppendLine("</linker>");
7979

80-
var filePathName = Path.Combine(Application.dataPath, "..", "Temp", "InputSystemLink.xml");
81-
File.WriteAllText(filePathName, sb.ToString());
82-
return filePathName;
80+
var linkXmlDirectory = Path.Combine(Application.dataPath, "..", "Library", "InputSystem");
81+
var linkXmlFile = Path.Combine(linkXmlDirectory, $"{data.target}Link.xml");
82+
83+
Directory.CreateDirectory(linkXmlDirectory);
84+
File.WriteAllText(linkXmlFile, sb.ToString());
85+
return linkXmlFile;
8386
}
8487

8588
static bool IsTypeUsedViaReflectionByInputSystem(Type type)

0 commit comments

Comments
 (0)