Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Tests/InputSystem/CoreTests_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2004,8 +2004,6 @@ public void Actions_CanCreateActionsWithoutAnActionMap()
[Category("Actions")]
public void Actions_CanCreateActionAssetWithMultipleActionMaps()
{
var gamepad = InputSystem.AddDevice<Gamepad>();

var asset = ScriptableObject.CreateInstance<InputActionAsset>();

var map1 = new InputActionMap("map1");
Expand Down Expand Up @@ -2042,6 +2040,8 @@ public void Actions_CanCreateActionAssetWithMultipleActionMaps()
// Enable only map1.
map1.Enable();

// Creating gamepad after maps are enabled to test trace catching binding resolve. Case ISXB-29.
var gamepad = InputSystem.AddDevice<Gamepad>();
Set(gamepad.leftStick, new Vector2(0.123f, 0.234f), startTime + 0.123);

// map1/action1 should have been started and performed.
Expand Down
3 changes: 2 additions & 1 deletion Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed `{fileID: 0}` getting appended to `ProjectSettings.asset` file when building a project ([case ISXB-296](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-296)).
- Fixed `Type of instance in array does not match expected type` assertion when using PlayerInput in combination with Control Schemes and Interactions ([case ISXB-282](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-282)).
- Fixed an InvalidOperationException when using Hold interaction, and by extension any interaction that changes to performed state after a timeout ([case ISXB-332](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-330)).
- Fixed `Given object is neither an InputAction nor an InputActionMap` when using `InputActionTrace` on input action from an input action asset ([case ISXB-29](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-29)).

## [1.4.3] - 2022-09-23

Expand Down Expand Up @@ -44,7 +45,7 @@ however, it has to be formatted properly to pass verification tests.
## [1.4.1] - 2022-05-30

### Fixed
- Fixed composite touchscreen controls were not firing an action if screen was touched before enabling the action ([case ISXB-98](https://jira.unity3d.com/browse/ISXB-98)).
- Fixed composite touchscreen controls were not firing an action if screen was touched before enabling the action ([case ISXB-98](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-98)).

## [1.4.0] - 2022-04-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private void UnhookOnActionChange()
m_OnActionChangeHooked = false;
}

private void OnActionChange(object actionOrMap, InputActionChange change)
private void OnActionChange(object actionOrMapOrAsset, InputActionChange change)
{
// If we're subscribed to all actions, check if an action got triggered.
if (m_SubscribedToAll)
Expand All @@ -448,8 +448,8 @@ private void OnActionChange(object actionOrMap, InputActionChange change)
case InputActionChange.ActionStarted:
case InputActionChange.ActionPerformed:
case InputActionChange.ActionCanceled:
Debug.Assert(actionOrMap is InputAction, "Expected an action");
var triggeredAction = (InputAction)actionOrMap;
Debug.Assert(actionOrMapOrAsset is InputAction, "Expected an action");
var triggeredAction = (InputAction)actionOrMapOrAsset;
var actionIndex = triggeredAction.m_ActionIndexInState;
var stateForAction = triggeredAction.m_ActionMap.m_State;

Expand All @@ -469,17 +469,20 @@ private void OnActionChange(object actionOrMap, InputActionChange change)
if (change != InputActionChange.BoundControlsAboutToChange)
return;

// Grab the associated action map.
var action = actionOrMap as InputAction;
InputActionMap actionMap;
if (action != null)
actionMap = action.m_ActionMap;
// Grab the associated action map(s).
if (actionOrMapOrAsset is InputAction action)
CloneActionStateBeforeBindingsChange(action.m_ActionMap);
else if (actionOrMapOrAsset is InputActionMap actionMap)
CloneActionStateBeforeBindingsChange(actionMap);
else if (actionOrMapOrAsset is InputActionAsset actionAsset)
foreach (var actionMapInAsset in actionAsset.actionMaps)
CloneActionStateBeforeBindingsChange(actionMapInAsset);
else
{
actionMap = actionOrMap as InputActionMap;
Debug.Assert(actionMap != null, "Given object is neither an InputAction nor an InputActionMap");
}
Debug.Assert(false, "Expected InputAction, InputActionMap or InputActionAsset");
}

private void CloneActionStateBeforeBindingsChange(InputActionMap actionMap)
{
// Grab the state.
var state = actionMap.m_State;
if (state == null)
Expand Down