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
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed PlayerInput component automatically switching away from the default ActionMap set to 'None'.
- Fixed a console error being shown when targeting visionOS builds in 2022.3.
- Fixed a Tap Interaction issue with analog controls. The Tap interaction would keep re-starting after timeout. [ISXB-627](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-627)
- Fixed the defaultActionMap dropdown in the PlayerInput component defaulting to <None> instead of the first ActionMap.
- Fixed TrackedPoseDriver stops updating position and rotation when device is added after its initialization. [ISXB-1555](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1555)
- Fixed PlayerInput component not working with C# Wrappers (ISXB-1535). This reverted changes done to fix [ISXB-920](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-920) but users can now fix it themselves.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@
}
}
#endif
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || CheckIfActionAssetChanged())
var assetChanged = CheckIfActionAssetChanged();

Check warning on line 99 in Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs#L99

Added line #L99 was not covered by tests
// initialize the editor component if the asset has changed or if it has not been initialized yet
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || assetChanged || m_ActionAssetInstanceID == 0)

Check warning on line 101 in Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs#L101

Added line #L101 was not covered by tests
{
OnActionAssetChange();
InitializeEditorComponent(assetChanged);

Check warning on line 103 in Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs#L103

Added line #L103 was not covered by tests
actionsWereChanged = true;
}

Expand Down Expand Up @@ -136,6 +138,7 @@
// Restore the initial color
GUI.backgroundColor = currentBg;


rect = EditorGUILayout.GetControlRect();
label = EditorGUI.BeginProperty(rect, m_AutoSwitchText, m_NeverAutoSwitchControlSchemesProperty);
var neverAutoSwitchValueOld = m_NeverAutoSwitchControlSchemesProperty.boolValue;
Expand Down Expand Up @@ -277,7 +280,8 @@
if (m_ActionsProperty.objectReferenceValue != null)
{
var assetInstanceID = m_ActionsProperty.objectReferenceValue.GetInstanceID();
bool result = assetInstanceID != m_ActionAssetInstanceID;
// if the m_ActionAssetInstanceID is 0 the PlayerInputEditor has not been initialized yet, but the asset did not change
bool result = assetInstanceID != m_ActionAssetInstanceID && m_ActionAssetInstanceID != 0;

Check warning on line 284 in Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs#L284

Added line #L284 was not covered by tests
m_ActionAssetInstanceID = (int)assetInstanceID;
return result;
}
Expand Down Expand Up @@ -454,19 +458,21 @@
m_NotificationBehaviorInitialized = true;
}

private void OnActionAssetChange()
private void InitializeEditorComponent(bool assetChanged)
{
serializedObject.ApplyModifiedProperties();
m_ActionAssetInitialized = true;

var playerInput = (PlayerInput)target;
var asset = (InputActionAsset)m_ActionsProperty.objectReferenceValue;

if (assetChanged)
m_SelectedDefaultActionMap = -1;

Check warning on line 470 in Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs#L469-L470

Added lines #L469 - L470 were not covered by tests
if (asset == null)
{
m_ControlSchemeOptions = null;
m_ActionMapOptions = null;
m_ActionNames = null;
m_SelectedDefaultActionMap = -1;
m_SelectedDefaultControlScheme = -1;
m_InvalidDefaultControlSchemeName = null;
return;
Expand Down