static void DoImport(DefaultAsset[] assets) { foreach (var asset in assets) { var settings = ImportSettingsReference.LoadImportSettings(asset); if (!settings) { CreateSettingsThenImport(assets); return; } } foreach (var asset in assets) { var reference = ImportSettingsReference.LoadImportSettings(asset); if (reference) { ASEImporter.Import(asset, reference.settings); } else { Debug.LogWarning("File " + asset.name + " has empty import settings, it is ignored."); } } }
private static void CompleteAutoImports() { EditorApplication.update = Delegate.Remove(EditorApplication.update, _importDelegate as EditorApplication.CallbackFunction) as EditorApplication.CallbackFunction; AssetDatabase.Refresh(); ASEImporter.Refresh(); foreach (var path in _autoImports) { var asset = AssetDatabase.LoadAssetAtPath <DefaultAsset>(path); var reference = ImportSettingsReference.LoadImportSettings(asset); if (reference?.settings && reference.settings.automaticReimport) { ASEImporter.Import(asset, reference.settings); } } _autoImports.Clear(); }