diff --git a/Editor/AddressableImporter.cs b/Editor/AddressableImporter.cs index 641c5e6..ec6961d 100644 --- a/Editor/AddressableImporter.cs +++ b/Editor/AddressableImporter.cs @@ -57,6 +57,8 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse #endif foreach (var importedAsset in importedAssets) { + if (IsAssetIgnored(importedAsset)) + continue; if (prefabStage == null || prefabAssetPath != importedAsset) // Ignore current editing prefab asset. dirty |= ApplyImportRule(importedAsset, null, settings, importSettings); } @@ -64,6 +66,8 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse for (var i = 0; i < movedAssets.Length; i++) { var movedAsset = movedAssets[i]; + if (IsAssetIgnored(movedAsset)) + continue; var movedFromAssetPath = movedFromAssetPaths[i]; if (prefabStage == null || prefabAssetPath != movedAsset) // Ignore current editing prefab asset. dirty |= ApplyImportRule(movedAsset, movedFromAssetPath, settings, importSettings); @@ -71,6 +75,8 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse foreach (var deletedAsset in deletedAssets) { + if (IsAssetIgnored(deletedAsset)) + continue; if (TryGetMatchedRule(deletedAsset, importSettings, out var matchedRule)) { var guid = AssetDatabase.AssetPathToGUID(deletedAsset); @@ -88,6 +94,11 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse } } + static bool IsAssetIgnored(string assetPath) + { + return assetPath.EndsWith(".meta") || assetPath.EndsWith(".DS_Store") || assetPath.EndsWith("~"); + } + static AddressableAssetGroup CreateAssetGroup(AddressableAssetSettings settings, string groupName) { return settings.CreateGroup(groupName, false, false, false, new List { settings.DefaultGroup.Schemas[0] }, typeof(SchemaType)); @@ -281,7 +292,7 @@ public static void ReimportFolders(IEnumerable assetPaths) foreach (var file in filesToAdd) { // Filter out meta and DS_Store files. - if (!file.EndsWith(".meta") && !file.EndsWith(".DS_Store")) + if (!IsAssetIgnored(file)) { pathsToImport.Add(file.Replace('\\', '/')); }