Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by maxmyth · Sep 15, 2011 at 11:28 AM · importassetassetspackage

Is it possible to import more than one asset package at the same time?

I wanted to import multiple asset packages at the same time.

Is this possible? If so then how?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by ericksson · Sep 15, 2011 at 12:53 PM

No, there is currently no way to import multiple asset packages at once. You have to import them one by one.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
10

Answer by IMD · Sep 17, 2018 at 07:53 PM

Hello, here's a nice class I've written today to both import and export multiple Unity packages via Menu > Tools from and to a chosen folder. Enjoy :)

 using UnityEngine;
 using UnityEditor;
 using System;
 using System.IO;
 
 /// <summary>
 /// Unity package helper. Provides Menu options for automatically importing and 
 /// exporting multiple Unity packages.
 /// Auth: Isaac Dart; 2018-09-17
 /// </summary>
 public class UnityPackageHelper
 {
     static int successCount = 0;
     [MenuItem("Tools/Unity Packages/Import Folder", false, 7)]
     public static void ImportPackagesFromFolder()
     {
         string pPath = "";
         successCount = 0;
         pPath = EditorUtility.OpenFolderPanel("Select Package Path", Application.dataPath, "");
 
         if (!String.IsNullOrEmpty(pPath)) {
 
            string[] files = Directory.GetFiles(pPath, "*.unitypackage");
            
             if (files != null && files.Length > 0) {
 
                 AssetDatabase.importPackageCompleted += PackageImportSuccess;
                 AssetDatabase.importPackageFailed += PackageImportFail;
                 for (int i = 0; i < files.Length; i++) { 
                     string packagePath = files[i];
                     AssetDatabase.ImportPackage(packagePath, false);
                 }
                 AssetDatabase.importPackageCompleted -= PackageImportSuccess;
                 AssetDatabase.importPackageFailed -= PackageImportFail;
 
                 Debug.Log("Import complete. " + successCount + " of " + files.Length + " packages successfully imported.");
 
             }
         }
 
     }
 
 static void PackageImportSuccess(string packageName)
 {
     successCount ++;
     Debug.Log("Completed import of package '" + packageName + "'");
 }
 
     static void PackageImportFail(string packageName, string errorMessage)
     {
         Debug.Log("Failed to import package '" + packageName + "' with error message '"+ errorMessage + "'.");
     }
 
 
     [MenuItem("Tools/Unity Packages/Export To Folder", false, 7)]
     public static void ExportSelectionAsPackages()
     {
         string pPath = "";
         successCount = 0;
         pPath = EditorUtility.OpenFolderPanel("Select Package Export Path", Application.dataPath, "");
 
         if (!String.IsNullOrEmpty(pPath))  
         {
             GameObject[] selected = Selection.gameObjects;
 
             if (selected != null && selected.Length > 0)
             {
 
                 for (int i = 0; i < selected.Length; i++)
                 {
                     GameObject transToPackage = selected[i];
                     string assetPath = AssetDatabase.GetAssetPath(transToPackage.GetInstanceID());
                     if (String.IsNullOrEmpty(assetPath)) continue; 
                     string exportPath = pPath + "/" + transToPackage.name + ".unitypackage";
                     Debug.Log(String.Format("Exporting '{0}' to '{1}' ...", assetPath, exportPath));
                     AssetDatabase.ExportPackage(assetPath, exportPath,ExportPackageOptions.IncludeDependencies);
                     successCount++;
                 }
                 if (successCount == 0) {
                     Debug.Log("No objects were selected in the project view.");
                 } else {
                     Debug.Log("Export complete. " + successCount + " of " + selected.Length + " selected objects successfully exported.");
                 }
 
             } else {
                 Debug.Log("Nothing selected to export.");
             }
         }
     }
 }



Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ruwaid4 · Aug 01, 2019 at 11:38 AM 1
Share

Thank you very much!

avatar image wmadwand · Sep 12, 2020 at 11:50 AM 0
Share

Thanks a bunch for your super script, buddy! Totally what i've been looking for.

avatar image Alex_F · Apr 21, 2021 at 03:45 PM 0
Share

Thank you!

avatar image protossguy · Jun 02 at 03:24 AM 0
Share

Hi, I've got this when trying to import a folder: "Import complete. 0 of 18 packages successfully imported." Do you know what's wrong?

avatar image protossguy protossguy · Jun 02 at 03:32 AM 0
Share

Oh my bad. It has been imported, but it in another folder. Thanks so much for the script!

avatar image TheUbMunster · Jun 03 at 05:41 AM 0
Share

If you want the importer to recursively search folders for *.unitypackages, then change the call to Directory.GetFiles(pPath, "*.unitypackage"); on line 23 to Directory.GetFiles(pPath, "*.unitypackage", SearchOption.AllDirectories);

avatar image
0

Answer by $$anonymous$$ · Feb 19, 2018 at 09:07 AM

Can we do it now?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image pako · Feb 19, 2018 at 09:47 AM 0
Share

Still no. Why do you want to import multiple assets at the same time anyway?

avatar image IMD · Aug 01, 2019 at 06:48 PM 1
Share

Hi @$$anonymous$$; yes my above script still works. Just drop it into a new class under an Editor folder and use the new menu which appears under Tools > Unity Packages > Import Folder. Cheers.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to import zipped package into Unity? 1 Answer

I cannot import packages in unity3D. Nothing to import error. 0 Answers

How may I import this Jello asset into my project 1 Answer

Script Compiller errors. need help fixing 1 Answer

Assets won't Import 4 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges