View Unity3d on the plugin site for more information.
A problem, An idea ?
Please use our tasks and issues tracker to report bugs, improvements or new feature.
Also if you want to propose some code change using a Github pull request, please open also a Jira issue. It is easier for developers to track them.
Unity3d is a powerful 3d game creation editor and engine that runs on Mac and Windows.
This plugin adds the ability to call the Unity3d Editor from the command line to automate build and packaging of Unity3d applications.
Automating Unity3d builds from the command line is possible. There are a few problems though:
- the unity runner writes its output to a separate log file, instead of the output
- tool and file locations are platform specific
- only one project can be built at a time per machine
This plugin aims to make it easier to run Unity3d builds easily in Jenkins, by adding the following features:
- log file redirection
- distributed builds
The plugin was tested with unity3d 3.4.2 and unity3d 3.5 beta. Tested on distributed and single server environments
As Unity3d is multi-platform, you may need to install the proper third party OS & tools (Android SDK, XCode, etc) depending on the type of build targets you intend to exercise.
Install the latest version of the plugin from the update center and configure a freestyle job (see #Usage Guide). If necessary restrict the job to the node(s) that will perform the build(s).
On the node(s) you are going to build Unity projects, add at least one unity3d installation (Manage Jenkins -> Configure System) and configure the location of the Unity3d installation. This location is by default
/Applications/Unity/Unity.app on Mac OS X and
C:\Program Files (x86)\Unity on Windows. The plugin will automatically suffix the installation path with the proper executable location.
The plugin assumes you've created a special Editor class with at least one method responsible for your build.
Here's an example extracted from one of our projects:
On Mac OS X, the user running needs to be logged in otherwise the Unity3d editor might fail to acquire the graphical resources. FIXME add a log.
The Unity Editor can only perform one build at a time. If you have multiple job, you may want to prevent more than one Unity jobs to be running at the single time. One simple way to achieve this is to have a single Executor on your build server node. This has of course drawbacks if you intend to run other types of jobs on the same node that are not affected by the same limitation.
Setting up a build step
Add the Unity3d build step to a free-style project, select the unity3d installation and set your command line arguments (e.g.
-quit -batchmode -executeMethod MyEditorScript.PerformMacOSXBuild). If you do not specify -projectPath (case-sensitive), the plugin will use the current workspace. You may want to add an extra step to clean the project before you build to make sure the build starts in a clean state.
If you want to build for iOS, you will have to add extra build steps to trigger xcode build. This step isn't covered here.
Unity3d Builder configuration parameters
The full command line, the builder adding the -projectPath (case-sensitive) if it isn't specified
Automatically installing unity3d (MacOSX)
To automatically install unity3d from jenkins (even beta versions)
- Install this script somewhere on your machines. E.g. /Users/Shared/Jenkins/Home/bin/
- run sudo visudo and add a line like
jenkins ALL=(ALL) NOPASSWD: /Users/Shared/Jenkins/Home/bin/install_unity3d.sh
- Create a parametrized job that takes a String parameter
default value: e.g. http://netstorage.unity3d.com/unity/unity-4.2.1.dmg
description: The URL of the DMG package to install
- Add a shell builder to your job:
- The Log Parser Plugin can help you to quickly set some parsing rules for your Unity3d builds. Here's a tentative set of rules that we use in one project:
- Automated management of iOS provisioning profiles
- Unity3d build pipeline using jenkins
- Command line install of Unity3d on mac
Version 0.5 (DEV IN PROGRESS)
Version 0.4 (16.09.2013)
- support build and environment variables injection into the command line
Version 0.3 (06.06.202)
- Validity of Unity3D project folder was not correctly checked when projectPath parameter was used.
Version 0.2 (30.01.2012)
Version 0.1 (24.01.2012)
- live redirection of the Editor.log file into the console
- supports distributed builds
- automatically adds the -projectPath command line