Skip to content

Commit c1e48c9

Browse files
chris-massieekcohjamesmcgill
authored
FIX: NullReferenceException when using Prefab Overrides window (#1567)
* Fixed InputActionDrawerBase not initializing the TreeView correctly - This change makes sure the TreeView.serializedObject matches the property. The value was null which was causing `OnGUI` to throw an exception. - The change to `UpdateSerializedObjectDirtyCount` was not necessary for this fix but it should protect against cases where the serializedObject becomes null for some reason. The `EditorUtility.GetDirtyCount` method returns 0 when the argument is null, so this seems like the appropriate thing to do. * CHANGE: move changelog entry into next release Co-authored-by: Håkan Sidenvall <hakan.sidenvall@unity3d.com> Co-authored-by: James McGill <james.mcgill@unity3d.com>
1 parent 4acce32 commit c1e48c9

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ however, it has to be formatted properly to pass verification tests.
1010

1111
## [Unreleased]
1212

13+
### Fixed
14+
- Fixed `ArgumentNullException` when opening the Prefab Overrides window and selecting a component with an `InputAction`.
1315

1416
## [1.4.3] - 2022-09-23
1517

@@ -36,7 +38,6 @@ however, it has to be formatted properly to pass verification tests.
3638
- Fixed an issue where `ReadUnprocessedValueFromState` in PoseControl always returning default values.
3739
- Fix Player 1's UI controls stop working after second player joins ([case ISXB-125](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-125)))
3840

39-
4041
## [1.4.1] - 2022-05-30
4142

4243
### Fixed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ private void OnSerializedObjectModified()
13911391

13921392
public void UpdateSerializedObjectDirtyCount()
13931393
{
1394-
m_SerializedObjectDirtyCount = EditorUtility.GetDirtyCount(serializedObject.targetObject);
1394+
m_SerializedObjectDirtyCount = serializedObject != null ? EditorUtility.GetDirtyCount(serializedObject.targetObject) : 0;
13951395
}
13961396

13971397
private bool ReloadIfSerializedObjectHasBeenChanged()

Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionDrawerBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private void InitTreeIfNeeded(SerializedProperty property)
4242
var viewData = GetOrCreateViewData(property);
4343
var propertyIsClone = IsPropertyAClone(property);
4444

45-
if (viewData.TreeView != null && !propertyIsClone)
45+
if (!propertyIsClone && viewData.TreeView != null && viewData.TreeView.serializedObject == property.serializedObject)
4646
return;
4747

4848
if (propertyIsClone)

0 commit comments

Comments
 (0)