Skip to content

Commit bbe3d1a

Browse files
Update PlayerInputEditor.cs
1 parent 6ba64b2 commit bbe3d1a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ public override void OnInspectorGUI()
9797

9898
var assetChanged = CheckIfActionAssetChanged();
9999
// initialize the editor component if the asset has changed or if it has not been initialized yet
100+
#if UNITY_6000_5_OR_NEWER
101+
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || assetChanged || m_ActionAssetEntityId == EntityId.None)
102+
#else
100103
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || assetChanged || m_ActionAssetInstanceID == 0)
104+
#endif
101105
{
102106
InitializeEditorComponent(assetChanged);
103107
actionsWereChanged = true;
@@ -278,6 +282,15 @@ bool CheckIfActionAssetChanged()
278282
{
279283
if (m_ActionsProperty.objectReferenceValue != null)
280284
{
285+
#if UNITY_6000_5_OR_NEWER
286+
EntityId assetEntityId = m_ActionsProperty.objectReferenceValue.GetEntityId();
287+
bool result = assetEntityId != m_ActionAssetEntityId && m_ActionAssetEntityId != EntityId.None;
288+
m_ActionAssetEntityId = assetEntityId;
289+
return result;
290+
}
291+
292+
m_ActionAssetEntityId = EntityId.None;
293+
#else
281294
// 6.4 deprecates instance id in favour of entity ids (a class)
282295
// Fortunately, there is an implicit cast from entity id to an integer so we can have minimum footprint for now.
283296
int assetInstanceID;
@@ -295,6 +308,8 @@ bool CheckIfActionAssetChanged()
295308
}
296309

297310
m_ActionAssetInstanceID = -1;
311+
#endif
312+
298313
return false;
299314
}
300315

@@ -656,7 +671,11 @@ void AddEntry(InputAction action, PlayerInput.ActionEvent actionEvent)
656671

657672
[NonSerialized] private bool m_NotificationBehaviorInitialized;
658673
[NonSerialized] private bool m_ActionAssetInitialized;
674+
#if UNITY_6000_5_OR_NEWER
675+
[NonSerialized] private EntityId m_ActionAssetEntityId;
676+
#else
659677
[NonSerialized] private int m_ActionAssetInstanceID;
678+
#endif
660679
}
661680
}
662681
#endif // UNITY_EDITOR

0 commit comments

Comments
 (0)