Skip to content

Commit 1a756df

Browse files
authored
FIX: InvalidOperationException thrown when entering PlayMode if Project-wide Input Action Asset changes didn't save (ISX-1953) (#1907)
* FIX: exception thrown due to ActionMap being in a bad state after deleting/resetting it. Error occurs because "reset" change wasn't saved to the asset and didn't correctly de-serialized after domain reload. Adding extra calls to SaveAssetOnFocusLost() ensures asset is properly saved
1 parent 335be33 commit 1a756df

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ however, it has to be formatted properly to pass verification tests.
1717
- Fixed an issue where `System.ObjectDisposedException` would be thrown when deleting the last ActionMap item in the Input Actions Asset editor.
1818
- Fixed DualSense Edge's vibration and light bar not working on Windows
1919
- Fixed Project-wide Actions asset failing to reload properly after deleting project's Library folder.
20+
- Fixed an issue where `System.InvalidOperationException` is thrown when entering PlayMode after deleting an ActionMap from Project-wide actions and later resetting it.
2021

2122
### Changed
2223
- For Unity 6.0 and above, when an `EventSystem` GameObject is created in the Editor it will have the

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public override void OnDeactivate()
7676
m_RootVisualElement.UnregisterCallback<FocusInEvent>(OnEditFocus);
7777
}
7878

79+
// Make sure any remaining changes are actually saved
80+
SaveAssetOnFocusLost();
81+
7982
// Note that OnDeactivate will also trigger when opening the Project Settings (existing instance).
8083
// Hence we guard against duplicate OnDeactivate() calls.
8184
if (m_HasEditFocus)
@@ -272,6 +275,8 @@ private void ModeChanged(PlayModeStateChange change)
272275
SetObjectFieldEnabled(true);
273276
break;
274277
case PlayModeStateChange.ExitingEditMode:
278+
// Ensure any changes are saved to the asset; FocusLost isn't always triggered when entering PlayMode.
279+
SaveAssetOnFocusLost();
275280
SetObjectFieldEnabled(false);
276281
break;
277282
case PlayModeStateChange.EnteredPlayMode:

0 commit comments

Comments
 (0)