Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 2 additions & 0 deletions Assets/Editor/DumpInputActionReferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ private static void DumpReferences(StringBuilder sb, string prefix, InputActionR
private static void DumpReferences()
{
var sb = new StringBuilder();
#pragma warning disable CS0618 // Type or member is obsolete
DumpReferences(sb, "Loaded objects", Object.FindObjectsByType<InputActionReference>(
FindObjectsInactive.Include, FindObjectsSortMode.InstanceID));
#pragma warning restore CS0618 // Type or member is obsolete
DumpReferences(sb, "All objects:", Resources.FindObjectsOfTypeAll<InputActionReference>());
Debug.Log(sb.ToString());
}
Expand Down
6 changes: 6 additions & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ however, it has to be formatted properly to pass verification tests.

## [Unreleased] - yyyy-mm-dd

### Changed

- Updated `m_ActionAssetInstanceID` in PlayerInputEditor.cs to use `EntityId` instead of `InstanceID`.

### Fixed

### Added

## [1.18.0] - 2026-01-14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@

var assetChanged = CheckIfActionAssetChanged();
// initialize the editor component if the asset has changed or if it has not been initialized yet
#if UNITY_6000_4_OR_NEWER
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || assetChanged || m_ActionAssetEntityId == EntityId.None)

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
#else
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || assetChanged || m_ActionAssetInstanceID == 0)
#endif
{
InitializeEditorComponent(assetChanged);
actionsWereChanged = true;
Expand Down Expand Up @@ -276,26 +280,22 @@
// One such case is when the user triggers a "Reset" on the component.
bool CheckIfActionAssetChanged()
{
if (m_ActionsProperty.objectReferenceValue != null)
{
// 6.4 deprecates instance id in favour of entity ids (a class)
// Fortunately, there is an implicit cast from entity id to an integer so we can have minimum footprint for now.
int assetInstanceID;

#if UNITY_6000_4_OR_NEWER
assetInstanceID = m_ActionsProperty.objectReferenceValue.GetEntityId();
#else
assetInstanceID = m_ActionsProperty.objectReferenceValue.GetInstanceID();
#endif

var obj = m_ActionsProperty.objectReferenceValue;
if (obj == null)
return false;

#if UNITY_6000_4_OR_NEWER
EntityId assetEntityId = obj.GetEntityId();
bool result = assetEntityId != m_ActionAssetEntityId && m_ActionAssetEntityId != EntityId.None;
m_ActionAssetEntityId = assetEntityId;
return result;

Check warning on line 291 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#L289-L291

Added lines #L289 - L291 were not covered by tests
#else
int assetInstanceID = obj.GetInstanceID();
// 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;
m_ActionAssetInstanceID = (int)assetInstanceID;
return result;
}

m_ActionAssetInstanceID = -1;
return false;
#endif
}

private void DoHelpCreateAssetUI()
Expand Down Expand Up @@ -656,7 +656,11 @@

[NonSerialized] private bool m_NotificationBehaviorInitialized;
[NonSerialized] private bool m_ActionAssetInitialized;
#if UNITY_6000_4_OR_NEWER
[NonSerialized] private EntityId m_ActionAssetEntityId;
#else
[NonSerialized] private int m_ActionAssetInstanceID;
#endif
}
}
#endif // UNITY_EDITOR