diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 49fb80f2a1..4e981b4547 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,7 +10,9 @@ however, it has to be formatted properly to pass verification tests. ## [Unreleased] - yyyy-mm-dd +### Fixed +- Fixed warnings being generated on Unity 6.4 and 6.5. (ISX-2395). ## [1.17.0] - 2025-11-25 diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs index e695f2b7eb..126fb83de3 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs @@ -328,8 +328,13 @@ internal static IEnumerable LoadInputActionReferencesFromA [MenuItem("Assets/Create/Input Actions")] public static void CreateInputAsset() { + #if UNITY_6000_4_OR_NEWER + ProjectWindowUtil.CreateAssetWithTextContent("New Actions." + InputActionAsset.Extension, + InputActionAsset.kDefaultAssetLayoutJson, InputActionAssetIconLoader.LoadAssetIcon()); + #else ProjectWindowUtil.CreateAssetWithContent("New Actions." + InputActionAsset.Extension, InputActionAsset.kDefaultAssetLayoutJson, InputActionAssetIconLoader.LoadAssetIcon()); + #endif } // File extension of the associated asset diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs index 6604a61287..da94a2d94f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using UnityEditor; using UnityEditor.Search; -using UnityEngine.Search; namespace UnityEngine.InputSystem.Editor { @@ -12,8 +11,6 @@ internal static class InputActionAssetSearchProviders const string k_AssetFolderSearchProviderId = "AssetsInputActionAssetSearchProvider"; const string k_ProjectWideActionsSearchProviderId = "ProjectWideInputActionAssetSearchProvider"; - const string k_ProjectWideAssetIdentificationString = " [Project Wide Input Actions]"; - internal static SearchProvider CreateInputActionAssetSearchProvider() { return CreateInputActionAssetSearchProvider(k_AssetFolderSearchProviderId, @@ -101,7 +98,17 @@ private static IEnumerable FilteredSearch(SearchContext context, Sea if (!label.Contains(context.searchText, System.StringComparison.InvariantCultureIgnoreCase)) continue; // Ignore due to filtering - yield return provider.CreateItem(context, asset.GetInstanceID().ToString(), label, createItemFetchDescription(asset), + + string itemId; + + // 6.4 deprecated instance ids in favour of entity ids + #if UNITY_6000_4_OR_NEWER + itemId = asset.GetEntityId().ToString(); + #else + itemId = asset.GetInstanceID().ToString(); + #endif + + yield return provider.CreateItem(context, itemId, label, createItemFetchDescription(asset), thumbnail, asset); } } @@ -110,7 +117,6 @@ private static IEnumerable FilteredSearch(SearchContext context, Sea // consistent between CreateItem and additional fetchLabel calls. private static string FetchLabel(Object obj) { - // if (obj == InputSystem.actions) return $"{obj.name}{k_ProjectWideAssetIdentificationString}"; return obj.name; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs index 8b66275e70..64725d6e89 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs @@ -12,7 +12,7 @@ internal static class SearchConstants // SearchFlags: these flags are used to customize how search is performed and how search // results are displayed in the advanced object picker. // Note: SearchFlags.Packages is not currently used and hides all results from packages. - internal static readonly SearchFlags PickerSearchFlags = SearchFlags.Sorted | SearchFlags.OpenPicker; + internal static readonly SearchFlags PickerSearchFlags = SearchFlags.OpenPicker; // Search.SearchViewFlags : these flags are used to customize the appearance of the PickerWindow. internal static readonly Search.SearchViewFlags PickerViewFlags = SearchViewFlags.DisableBuilderModeToggle @@ -84,7 +84,17 @@ private static IEnumerable FilteredSearch(SearchContext context, Sea var label = fetchObjectLabel(asset); if (!label.Contains(context.searchText, System.StringComparison.InvariantCultureIgnoreCase)) continue; // Ignore due to filtering - yield return provider.CreateItem(context, asset.GetInstanceID().ToString(), label, createItemFetchDescription(asset), + + string itemId; + + // 6.4 deprecated instance ids in favour of entity ids + #if UNITY_6000_4_OR_NEWER + itemId = asset.GetEntityId().ToString(); + #else + itemId = asset.GetInstanceID().ToString(); + #endif + + yield return provider.CreateItem(context, itemId, label, createItemFetchDescription(asset), null, asset); } } diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs index 197d96cbc4..1d2acb500c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs @@ -278,7 +278,16 @@ bool CheckIfActionAssetChanged() { if (m_ActionsProperty.objectReferenceValue != null) { - var assetInstanceID = m_ActionsProperty.objectReferenceValue.GetInstanceID(); + // 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 + // 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;