- Home /
Creating a unity package automatically
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.
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. u$$anonymous$$ate 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. http://unity3d.com/support/documentation/ScriptReference/AssetDatabase.html 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 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 iwHiteRabbiT · 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.
Your answer
Follow this Question
Related Questions
Building my Game 0 Answers
How to export to gradle using BuildPipeline.BuildPlayer 2 Answers
Blender Modeling To Unity 3D. 1 Answer
Include parent/super class in a package export? 1 Answer
Export Package Asset Path Issue 0 Answers