Hi, We are doing a unity package which depends on all kind of external items. We also have a nightly build in which we compile and update everything. This results in a nightly installer. Today, I need to create our package manually every time. This involves changing a couple of assets (importing them) and then exporting everything as a package. I would like to do this automatically (unattended). What I would like to do is overwrite the relevant files in the file system (including changing stuff like version number in existing scripts) and then run unity to import/recompile the assets (and give me an error message if relevant), choose some of the files recursively (i.e. everything excluding the asset store tools directory) and export a package including them to a predefined location. Is there a way to do this? Thanks.
Anyone knows the answer for this?
Answer by kork
Sep 02, 2013 at 01:34 PM
Probably a bit late, but maybe someone else stumbles upon this: You could use uTomate for this. With this you can build an automation plan to export stuff from your project using the export unity package action. You can also run uTomate from the command line so you can incorporate this into your nightly builds.
+1. uTomate does this very well, and so much more. It's the #1 tool that Unity developers shouldn't be without.
Answer by TowerOfBricks
Dec 28, 2011 at 03:38 PM
There are ways to do that, try writing an editor script using the AssetDatabase class.
It has got an ExportPackage and ImportPackage function. But out of own experience, don't export a package just to import another one later in the same script, unity needs some time importing and compiling the stuff, I almost lost half of my project code that way because unity overwrote it.
Changing version numbers can be done using System.IO classes, see tutorials on editing text files.
I can confirm that this can work really well as I have a script which at the click of a button exports a backup (always do this, trust me), then edits scripts automatically, hard coding #ifs and such, and then exports some folders of my choice to a target location.
Thanks for the response, is there a way to do this from the command line? i.e. I don't want to manually open up unity but rather for a script which runs over night to do everything
Don't think so unfortunately, you would have to open up Unity and click some button there.
Answer by frarees
Sep 02, 2013 at 01:49 PM
Use AssetDatabase.ExportPackage. Create a static method that creates the package in order to call it from command line. See this for reference. -executeMethod is what you want.
Answer by error0
Mar 26, 2014 at 02:59 PM
This is a really late answer to this problem, but as I searched for it and came across this answer, I felt the need to contribute for those who may come after me. uTomate is a really good solution, but if you feel the need to build it yourself, you can call editor scripts from the command line. We use the Unity3dBuilder to integrate our Unity projects with Jenkins, and this is what that project does. Hopefully this information helps others.
Answer by eclectyc
Oct 01, 2014 at 10:57 AM
I recently had a similar problem, I had to manage several unity packages within a project, and maintain them updated.
I have developed a tool for this, you can find it on the asset store under the name Custom Package.
Hope this will meet your expectations.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
10 People are following this question.
Export Package Asset Path Issue
No flash export to Unity 4.5.5f1
Error Compressing TAR when exporting package
invalid assetdatabase path unity warning error
Lightmap on different PC questions...