Beispiel #1
0
        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);
        }
Beispiel #2
0
        public static bool ImportLocal(ExportPackage package)
        {
            string unityPackagePath = string.Empty;

            if (package != null)
            {
                unityPackagePath = Paths.GetLocalUnityPackagePath(package);
            }
            return(Import(unityPackagePath, package));
        }
Beispiel #3
0
 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;
             }
         }
     }
 }
Beispiel #4
0
 public static string GetLocalUnityPackagePath(ExportPackage package)
 {
     return(string.Format("{0}{1}.unitypackage", LocalExportedPackagePath, package.Name));
 }