public static bool Import(string unityPackageFilePath, ExportPackage package) { bool success = false; if (package != null) { if (File.Exists(unityPackageFilePath)) { DeletePackage(package, false); AssetDatabase.ImportPackage(unityPackageFilePath, false); success = true; ImportedManifest.AddPackage(package); WriteImportedManifest(); Debug.Log("Imported package " + package.Name); } else { Debug.LogError("Unity package does not exist: " + unityPackageFilePath); } if (!success) { Debug.LogError("Failed to import package " + package.Name); } } else { Debug.LogError("Cannot import null packages"); } return(success); }
public static bool ImportLocal(ExportPackage package) { string unityPackagePath = string.Empty; if (package != null) { unityPackagePath = Paths.GetLocalUnityPackagePath(package); } return(Import(unityPackagePath, package)); }
public void RemovePackage(ExportPackage package) { if (package != null && !string.IsNullOrEmpty(package.Name)) { for (int i = 0; i < _packages.Count; i++) { if (_packages[i].Name == package.Name) { _packages.RemoveAt(i--); break; } } } }
public static string GetLocalUnityPackagePath(ExportPackage package) { return(string.Format("{0}{1}.unitypackage", LocalExportedPackagePath, package.Name)); }