Skip to content

Commit ef19674

Browse files
committed
Merge branch 'develop' into isxb-1024-action-navigation-after-rename
2 parents 258e5eb + e8834d4 commit ef19674

File tree

12 files changed

+1245
-163
lines changed

12 files changed

+1245
-163
lines changed

Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = 5
7474
#endregion
7575

7676
[Test]
77+
[Ignore("Instability, see ISXB-1284")]
7778
public void CanListActionMaps()
7879
{
7980
var actionMapsContainer = m_Window.rootVisualElement.Q("action-maps-container");
@@ -87,6 +88,7 @@ public void CanListActionMaps()
8788
}
8889

8990
[UnityTest]
91+
[Ignore("Instability, see ISXB-1284")]
9092
public IEnumerator CanCreateActionMap()
9193
{
9294
var button = m_Window.rootVisualElement.Q<Button>("add-new-action-map-button");
@@ -115,6 +117,7 @@ public IEnumerator CanCreateActionMap()
115117
}
116118

117119
[UnityTest]
120+
[Ignore("Instability, see ISXB-1284")]
118121
public IEnumerator CanRenameActionMap()
119122
{
120123
var actionMapsContainer = m_Window.rootVisualElement.Q("action-maps-container");
@@ -163,6 +166,7 @@ public IEnumerator CanRenameActionMap()
163166
}
164167

165168
[UnityTest]
169+
[Ignore("Instability, see ISXB-1284")]
166170
public IEnumerator CanDeleteActionMap()
167171
{
168172
var actionMapsContainer = m_Window.rootVisualElement.Q("action-maps-container");

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
{

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ 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).
3536
- Fixed arrow key navigation of Input Actions after Action rename. [ISXB-1024](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1024)
3637

3738
### Changed

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.

Packages/com.unity.inputsystem/InputSystem/Controls/ButtonControl.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public class ButtonControl : AxisControl
3434
/// <summary>
3535
/// The minimum value the button has to reach for it to be considered pressed.
3636
/// </summary>
37-
/// <value>Button press threshold.</value>
3837
/// <remarks>
3938
/// The button is considered pressed, if it has a value equal to or greater than
4039
/// this value.
@@ -64,7 +63,6 @@ public class ButtonControl : AxisControl
6463
/// <summary>
6564
/// Return <see cref="pressPoint"/> if set, otherwise return <see cref="InputSettings.defaultButtonPressPoint"/>.
6665
/// </summary>
67-
/// <value>Effective value to use for press point thresholds.</value>
6866
public float pressPointOrDefault => pressPoint > 0 ? pressPoint : s_GlobalDefaultButtonPressPoint;
6967

7068
/// <summary>
@@ -106,7 +104,7 @@ public ButtonControl()
106104
/// <remarks>
107105
/// The default format for the control is <see cref="InputStateBlock.FormatBit"/>.
108106
/// The control's minimum value is set to 0 and the maximum value to 1.
109-
/// See <see cref="InputSettings.defaultButtonPressPoint"/> for the default press point.
107+
/// See <see cref="InputSettings.defaultButtonPressPoint"/> and <see cref="pressPoint"/>for the (default) press point.
110108
/// </remarks>
111109
/// <example>
112110
/// <code>
@@ -143,10 +141,9 @@ public ButtonControl()
143141
/// <summary>
144142
/// Whether the button is currently pressed.
145143
/// </summary>
146-
/// <value>True if button is currently pressed.</value>
147144
/// <remarks>
148145
/// A button is considered pressed if its value is equal to or greater
149-
/// than its button press threshold (<see cref="pressPointOrDefault"/>).
146+
/// than its button press threshold (<see cref="pressPointOrDefault"/>, <see cref="pressPoint"/>).
150147
/// </remarks>
151148
/// <example>
152149
/// <para>You can use this to read whether specific keys are currently pressed by using isPressed on keys, as shown in the following examples:</para>
@@ -242,7 +239,6 @@ private void BeginTestingForFramePresses(bool currentlyPressed, bool pressedLast
242239
/// <summary>
243240
/// Whether the press started this frame.
244241
/// </summary>
245-
/// <value>True if the current press of the button started this frame.</value>
246242
/// <remarks>
247243
/// The first time this function - or wasReleasedThisFrame - are called, it's possible that extremely fast
248244
/// inputs (or very slow frame update times) will result in presses/releases being missed.
@@ -304,12 +300,12 @@ public bool wasPressedThisFrame
304300
/// <summary>
305301
/// Whether the press ended this frame.
306302
/// </summary>
307-
/// <value>True if the current press of the button ended this frame.</value>
308303
/// <remarks>
309304
/// _Note_: The Input System identifies keys by physical layout, not according to the current language mapping of the keyboard. To query the name of the key according to the language mapping, use <see cref="InputControl.displayName"/>.
310305
/// </remarks>
311306
/// <example>
312307
/// <para>An example showing the use of this property on a gamepad button and a keyboard key:</para>
308+
///
313309
/// <code>
314310
/// using UnityEngine;
315311
/// using UnityEngine.InputSystem;

0 commit comments

Comments
 (0)