Scripting Guide

This guide covers the basics of how to build a Unity project by script. These are the same instructions you would enter into Terminal (Mac) or Command Prompt (Windows) but saved into a single file that can be run as required.

It also covers the use of Scripts with the Multiple Projects Exporter asset. Here we can group together a set of custom build settings that are applied right before the script is run. The script then takes over and can perform additional procedures outside of Unity.


Do I even need a script?
If your build process is covered by Unity’s built-in tools (or the Multiple Projects Exporter tools) then probably not. Scripting becomes a requirement when there are additional procedures that need to take place after the project has been built but before it can be distributed or released.

You could of-course perform these processes manually, but this is where a script could do the hard work for you! Of course writing the perfect script that turns your entire build process into a one-click procedure could take a while, but if you’re planning further releases or updates then it is usually worth spending the time to automate the process as much as possible.


File Formats

Mac – you can build a Unity project from Shell script (.sh). This file will need to open in Terminal (control-click ––> Open With) and it will need to be defined as executable. This can be done using the chmod command as below (you will need to specify the correct file path).

chmod 755 ~/Documents/ScriptPath/ScriptName.sh
Please note: This guide is a work-in-progress and will be completed shortly!