diff --git a/Editor/AddressableImporter.cs b/Editor/AddressableImporter.cs index e8f201c..66a012c 100644 --- a/Editor/AddressableImporter.cs +++ b/Editor/AddressableImporter.cs @@ -37,8 +37,10 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse { // Skip if all imported and deleted assets are addressables configurations. var isConfigurationPass = - (importedAssets.Length > 0 && importedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))) && - (deletedAssets.Length > 0 && deletedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))); + (importedAssets.Length == 0 || importedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))) && + (deletedAssets.Length == 0 || deletedAssets.All(x => x.StartsWith("Assets/AddressableAssetsData"))) && + movedAssets.Length == 0 && movedFromAssetPaths.Length == 0; + if (isConfigurationPass) { return; @@ -93,7 +95,7 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse if (importSettingsList.ShowImportProgressBar && EditorUtility.DisplayCancelableProgressBar( "Processing addressable import settings", $"[{i}/{importedAssets.Length}] {importedAsset}", - (float) i / importedAssets.Length)) + (float)i / importedAssets.Length)) break; foreach (var importSettings in hasRuleSettingsList) @@ -229,7 +231,8 @@ static AddressableAssetEntry CreateOrUpdateAddressableAssetEntry( // Set group settings from template if necessary if (rule.groupTemplate != null && (newGroup || rule.groupTemplateApplicationMode == - GroupTemplateApplicationMode.AlwaysOverwriteGroupSettings)) { + GroupTemplateApplicationMode.AlwaysOverwriteGroupSettings)) + { // Due to ApplyToAddressableAssetGroup only applies schema values for the group to the schema // values found in the source template, all schema objects of the source template should be // manually added to the target group before run the ApplyToAddressableAssetGroup function. @@ -277,8 +280,11 @@ static AddressableAssetEntry CreateOrUpdateAddressableAssetEntry( foreach (var dynamicLabel in rule.dynamicLabels) { var label = rule.ParseReplacement(assetPath, dynamicLabel); - settings.AddLabel(label); - entry.labels.Add(label); + if (!string.IsNullOrEmpty(label)) + { + settings.AddLabel(label); + entry.labels.Add(label); + } } } } @@ -357,16 +363,17 @@ public static void ReimportFolders(IEnumerable assetPaths, bool showConf if (!dir.StartsWith(".") && !dir.EndsWith("~")) { pathsToImport.Add(dir.Replace('\\', '/')); - } - } - // Add files. - var filesToAdd = Directory.GetFiles(assetPath, "*", SearchOption.AllDirectories); - foreach (var file in filesToAdd) - { - // Filter out meta and DS_Store files. - if (!IsAssetIgnored(file)) - { - pathsToImport.Add(file.Replace('\\', '/')); + + // Add files. + var filesToAdd = Directory.GetFiles(dir, "*", SearchOption.TopDirectoryOnly); + foreach (var file in filesToAdd) + { + // Filter out meta and DS_Store files. + if (!IsAssetIgnored(file)) + { + pathsToImport.Add(file.Replace('\\', '/')); + } + } } } }