/// <summary> /// Read registries from XML configuration files. /// </summary> /// <returns>Dictionary of registries indexed by URL.</returns> private static Dictionary <string, UnityPackageManagerRegistry> ReadRegistriesFromXml() { // Read registries from XML files. var xmlReader = new XmlUnityPackageManagerRegistries(); xmlReader.ReadAll(logger); return(xmlReader.Registries); }
/// <summary> /// Called by Unity when all assets have been updated and checks to see whether any registries /// have changed. /// </summary> /// <param name="importedAssets">Imported assets.</param> /// <param name="deletedAssets">Deleted assets.</param> /// <param name="movedAssets">Moved assets.</param> /// <param name="movedFromAssetPaths">Moved from asset paths. (unused)</param> private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { if (!Enable) { return; } bool registriesChanged = false; var checkAssets = new List <string>(importedAssets); checkAssets.AddRange(movedAssets); foreach (var asset in checkAssets) { if (XmlUnityPackageManagerRegistries.IsRegistriesFile(asset)) { registriesChanged = true; break; } AssetImporter importer = AssetImporter.GetAtPath(asset); if (importer != null) { foreach (var assetLabel in AssetDatabase.GetLabels(importer)) { if (assetLabel == XmlUnityPackageManagerRegistries.REGISTRIES_LABEL) { registriesChanged = true; break; } } } } if (registriesChanged) { CheckRegistries(); } }