Skip to content

Commit 1267521

Browse files
authored
FIX: Will now close Input Action Asset Editor windows from previous sessions when the corresponding action was deleted. (#850)
1 parent 451cbfd commit 1267521

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ however, it has to be formatted properly to pass verification tests.
1010
## [0.9.7-preview] - 2099-1-1
1111

1212
### Fixed
13+
14+
-Will now close Input Action Asset Editor windows from previous sessions when the corresponding action was deleted.
15+
1316
#### Actions
17+
18+
- Fixed `CallbackContext.ReadValue` throwing when invoked during device removal
19+
1420
### Changed
1521
### Added
1622

@@ -24,7 +30,6 @@ however, it has to be formatted properly to pass verification tests.
2430

2531
#### Actions
2632

27-
- Fixed `CallbackContext.ReadValue` throwing when invoked during device removal
2833
- Setting timeouts from `IInputInteraction.Process` not working as expected when processing happened in response to previous timeout expiring (#714).
2934
- Pending timeouts on a device not being removed when device was removed.
3035

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionAssetManager.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ private InputActionAsset importedAsset
4646
if (m_ImportedAssetObject == null)
4747
LoadImportedObjectFromGuid();
4848

49-
Debug.Assert(m_ImportedAssetObject != null);
5049
return m_ImportedAssetObject;
5150
}
5251
}
@@ -64,16 +63,22 @@ public InputActionAssetManager(InputActionAsset inputActionAsset)
6463

6564
public bool dirty => m_IsDirty;
6665

67-
public void Initialize()
66+
public bool Initialize()
6867
{
6968
if (m_AssetObjectForEditing == null)
7069
{
70+
if (importedAsset == null)
71+
// The asset we want to edit no longer exists.
72+
return false;
73+
7174
CreateWorkingCopyAsset();
7275
}
7376
else
7477
{
7578
m_SerializedObject = new SerializedObject(m_AssetObjectForEditing);
7679
}
80+
81+
return true;
7782
}
7883

7984
public void Dispose()

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,12 @@ private void OnEnable()
210210
// Initialize after assembly reload.
211211
if (m_ActionAssetManager != null)
212212
{
213-
m_ActionAssetManager.Initialize();
213+
if (!m_ActionAssetManager.Initialize())
214+
{
215+
// The asset we want to edit no longer exists.
216+
Close();
217+
return;
218+
}
214219
m_ActionAssetManager.onDirtyChanged = OnDirtyChanged;
215220

216221
InitializeTrees();

0 commit comments

Comments
 (0)