Skip to content

Commit 75c1574

Browse files
authored
Merge branch 'develop' into ci/add-coverage
2 parents 44891de + aec5efc commit 75c1574

File tree

19 files changed

+1853
-389
lines changed

19 files changed

+1853
-389
lines changed

Assets/Tests/InputSystem/CorePerformanceTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,10 @@ public void Performance_OptimizedControls_ReadingPose4kTimes(OptimizationTestTyp
11131113
"InputSystem.onAfterUpdate",
11141114
"PreUpdate.NewInputUpdate",
11151115
"PreUpdate.InputForUIUpdate",
1116-
"FixedUpdate.NewInputFixedUpdate"
1116+
"FixedUpdate.NewInputFixedUpdate",
1117+
"InputAction.Disable",
1118+
"InputAction.Enable",
1119+
"InputActionMap.ResolveBindings"
11171120
};
11181121

11191122
[PrebuildSetup(typeof(ProjectWideActionsBuildSetup))]

Assets/Tests/InputSystem/Plugins/PlayerInputTests.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,6 +2405,39 @@ public void PlayerInput_CanDisableAfterAssigningAction_WithControlSchemesAndInte
24052405
player.SetActive(false); // Should cause full rebinding and not assert
24062406
}
24072407

2408+
[Test]
2409+
[Category("PlayerInput")]
2410+
public void PlayerInput_DelegatesAreUpdate_WhenActionMapAddedAfterAssignment()
2411+
{
2412+
var gamepad = InputSystem.AddDevice<Gamepad>();
2413+
2414+
var go = new GameObject();
2415+
var listener = go.AddComponent<MessageListener>();
2416+
var playerInput = go.AddComponent<PlayerInput>();
2417+
playerInput.defaultActionMap = "Other";
2418+
var actionAsset = InputActionAsset.FromJson(kActions);
2419+
playerInput.actions = actionAsset;
2420+
2421+
// Disable the asset while adding another action map to it as none
2422+
// of the actions in the asset can be enabled during modification
2423+
//
2424+
actionAsset.Disable();
2425+
var keyboard = InputSystem.AddDevice<Keyboard>();
2426+
var newActionMap = actionAsset.AddActionMap("NewMap");
2427+
var newAction = newActionMap.AddAction("NewAction");
2428+
newAction.AddBinding("<Keyboard>/k", groups: "Keyboard");
2429+
actionAsset.AddControlScheme("Keyboard").WithRequiredDevice<Keyboard>();
2430+
actionAsset.Enable();
2431+
2432+
playerInput.currentActionMap = newActionMap;
2433+
playerInput.ActivateInput();
2434+
listener.messages.Clear();
2435+
2436+
Press(keyboard.kKey);
2437+
2438+
Assert.That(listener.messages, Has.Exactly(1).With.Property("name").EqualTo("OnNewAction"));
2439+
}
2440+
24082441
private struct Message : IEquatable<Message>
24092442
{
24102443
public string name { get; set; }
@@ -2477,6 +2510,11 @@ public void OnOtherAction(InputValue value)
24772510
messages?.Add(new Message { name = "OnOtherAction", value = value.Get<float>() });
24782511
}
24792512

2513+
public void OnNewAction(InputValue value)
2514+
{
2515+
messages?.Add(new Message { name = "OnNewAction", value = value.Get<float>() });
2516+
}
2517+
24802518
// ReSharper disable once UnusedMember.Local
24812519
public void OnActionWithSpaces(InputValue value)
24822520
{

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,13 +1793,15 @@ public IEnumerator UI_CanReleaseAndPressTouchesOnSameFrame()
17931793
.Matches((UICallbackReceiver.Event e) => e.pointerData.pointerType == UIPointerType.Touch).And
17941794
.Matches((UICallbackReceiver.Event e) => e.pointerData.position == secondPosition));
17951795

1796+
#if UNITY_2021_2_OR_NEWER
17961797
Assert.That(scene.rightChildReceiver.events,
17971798
Has.Exactly(1).With.Property("type").EqualTo(EventType.PointerMove).And
17981799
.Matches((UICallbackReceiver.Event e) => e.pointerData.device == touchScreen).And
17991800
.Matches((UICallbackReceiver.Event e) => e.pointerData.touchId == 2).And
18001801
.Matches((UICallbackReceiver.Event e) => e.pointerData.pointerId == pointerIdTouch2).And
18011802
.Matches((UICallbackReceiver.Event e) => e.pointerData.pointerType == UIPointerType.Touch).And
18021803
.Matches((UICallbackReceiver.Event e) => e.pointerData.position == secondPosition));
1804+
#endif
18031805

18041806
// Pointer 3
18051807
Assert.That(scene.rightChildReceiver.events,

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ however, it has to be formatted properly to pass verification tests.
3232
- Fixed an issue in `Samples/Visualizers/GamepadVisualizer.unity` sample where the visualization wouldn't handle device disconnects or current device changes properly (ISXB-1243).
3333
- Fixed an issue when displaying Serialized InputAction's Processor properties inside the Inspector window. [ISXB-1269](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1269)
3434
- Fixed an issue with default device selection when adding new Control Scheme.
35+
- 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).
36+
- 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)
3537

3638
### Changed
3739
- Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086).
@@ -41,6 +43,7 @@ however, it has to be formatted properly to pass verification tests.
4143

4244
### Added
4345
- Added new API `InputSystem.settings.useIMGUIEditorForAssets` that should be used in custom `InputParameterEditor` that use both IMGUI and UI Toolkit.
46+
- Added ProfilerMakers to `InputAction.Enable()` and `InputActionMap.ResolveBindings()` to enable gathering of profiling data.
4447

4548
## [1.11.2] - 2024-10-16
4649

@@ -70,6 +73,7 @@ however, it has to be formatted properly to pass verification tests.
7073
- Fixed potential crash on Mac when using stale references to deleted InputDevice objects [ISXB-606](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-606).
7174
- Fixed conditional compilation for non-editor analytics on platforms not enabling analytics.
7275
- Fixed simulated touch input not working with PlayerInput component [ISXB-483](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-483).
76+
- Fixed unused PenState information to determine the displayIndex on platforms providing it. (PLAT-10123)
7377

7478
### Changed
7579
- Renamed editor Resources directories to PackageResources to fix package validation warnings.

Packages/com.unity.inputsystem/DocCodeSamples.Tests/DocCodeSamples.asmdef

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"references": [
55
"GUID:75469ad4d38634e559750d17036d5f7c"
66
],
7-
"includePlatforms": [],
7+
"includePlatforms": [
8+
"Editor"
9+
],
810
"excludePlatforms": [],
911
"allowUnsafeCode": false,
1012
"overrideReferences": true,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#if UNITY_INPUT_SYSTEM_ENABLE_UI
2+
3+
using UnityEngine;
4+
using UnityEngine.InputSystem.UI;
5+
6+
namespace DocCodeSamples.Tests
7+
{
8+
internal class InputSystemUIInputModuleAssignActionsExample : MonoBehaviour
9+
{
10+
// Reference to the InputSystemUIInputModule component, needs to be provided in the Inspector
11+
public InputSystemUIInputModule uiModule;
12+
13+
void Start()
14+
{
15+
// Assign default actions
16+
AssignActions();
17+
}
18+
19+
void AssignActions()
20+
{
21+
if (uiModule != null)
22+
uiModule.AssignDefaultActions();
23+
else
24+
Debug.LogError("InputSystemUIInputModule not found.");
25+
}
26+
27+
void UnassignActions()
28+
{
29+
if (uiModule != null)
30+
uiModule.UnassignActions();
31+
else
32+
Debug.LogError("InputSystemUIInputModule not found.");
33+
}
34+
35+
void OnDestroy()
36+
{
37+
// Unassign actions when the object is destroyed
38+
UnassignActions();
39+
}
40+
}
41+
}
42+
#endif

Packages/com.unity.inputsystem/DocCodeSamples.Tests/InputSystemUIInputModuleAssignActionsExample.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)