Whilst developing Light over the last 10 months I’ve discovered a lot about the Unity engine. But one thing that always bothered me was building an application to multiple targets at the same time whilst also archiving the older builds and incrementing the version number for each build was the time it took to do it manually. So I put together a little script to take care of that all for me and hopefully it can help you with your own projects as well by building for all of your targets by clicking one button and walking away.

So far it only supports Mac (32,64, Universal), Linux (32,64,Universal) and Windows (32,64) as that was what I was targeting, but you can easily add your own targets to it too.

The package contains under the MIT License:

BuildManager.cs – Which adds a Build toolbar within your editor, you can open up the file and play around with the options and add your own targets in here. By default it will Build your project to “D:\Builds”, you will want to change this to your own directory, and by default your project will be called “Light“, you will want to change this too.

When you choose a to build to Linux for example, it will create a folder under your build location called either “Linux_32”, “Linux_64” or “Linux_32_64” depending on your target selection and then create a folder which is timestamped which contains your project. This makes archiving builds very simple.

Building will also increment the sub-minor version number.

You can change the Major, Minor and Sub-minor number by using the Build drop down and also switch to a release / alpha version by pressing the relevant button. This doesn’t do anything except prepend your version number with (“r”) or (“a”), useful for testing later on.

VersionNumber.cs – This is an example that allows you to print your current build version number to the Debug Log, you might want to link this up to some UI elements. It will load a TextAsset called “Version” and just print the text contained within it (Which should just be your version number)