• 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
4
Question by Mads Bgeskov · Jan 27, 2010 at 03:25 PM · export

Export files to a UnityPackage file from C#

My question is very simple, I want to be able to export files from my Unity project to a UnityPackage from code, preferably C#.

This will be used for easy deployment of a tool, i am creating, to my clients.

Is this possible ?

Comment
Add comment · Show 1
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 Aubrey-Falconer · Dec 24, 2010 at 07:14 AM 0
Share

Does Unity 3 shed any new light on this subject? I too would love to do this...

6 Replies

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

Answer by Ashkan_gc · Jan 27, 2010 at 05:32 PM

unfortunately there is no exposed API for this. just you can use the menu item. just for importing them you can use the -importpackage command line switch. hopefully it will be exposed in next releases. you can create a ticket in feedback for it.

Comment
Add comment · Show 1 · 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
0

Answer by equalsequals · Jan 27, 2010 at 05:26 PM

I am going to assume that you are referring to a Unity Asset Package, which uses the file extension ".unitypackage".

You actually don't need to bother with writing any code at all. Just select all of the files you want to be wrapped in the package, or just the root folder if they all share the same directory, then go to "Assets>Export Package..."

You'll get a checked list of all the files you want to include, then just hit "Export..." and you should be good to go. This is how I pass my custom script libraries around.

Hope that helps,

==

Comment
Add comment · Show 1 · 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 Mads Bgeskov · Feb 08, 2010 at 06:59 PM 0
Share

No, the problem is that I need to it in code.

avatar image
1

Answer by Ben 2 · Jan 27, 2010 at 05:48 PM

I'm not sure if there are any differences between the contents of the .unitypackage and a "regular" asset bundle but another option to do this from code might be to make an exec call from your code to execute Unity on the command line.

Check out my bash script at Unity Answers and look into the Process class in C# (MSDN Page)

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
5

Answer by paleozogt · Mar 14, 2013 at 03:15 PM

Actually, you can use AssetDatabase.ExportPackage

Comment
Add comment · Show 3 · 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 Bunny83 · Mar 14, 2013 at 03:33 PM 0
Share

It's funny that most people post comments as answers but you posted an answer as comment ;) I've converted it to an answer.

Btw. This function has beed added in Unity3.2, so it doesn't exist before

avatar image paleozogt · Mar 14, 2013 at 03:34 PM 0
Share

Heh, actually I did post it as an answer, but it was awaiting moderation. :)

avatar image Bunny83 · Mar 14, 2013 at 04:20 PM 0
Share

I see... ;)

avatar image
1

Answer by paleozogt · Mar 14, 2013 at 03:41 PM

You can export a .unitypackage from C# with AssetDatabase.ExportPackage

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
  • 1
  • 2
  • ›

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

animated model, maya 1 Answer

Can i export my Unity project back to Xcode 1 Answer

What is the best way to export textures with objects? 2 Answers

Graphics Settings for Builds Question 2 Answers

Is there a way to export animated UVs from a 3d package? 2 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