Skip to content

A Teamcity plugin for building Unity3d projects. NOTE: this has an MIT license so feel free to copy / adapt as you need to.

Notifications You must be signed in to change notification settings

callidus/Teamcity-unity3d-build-runner-plugin

 
 

Repository files navigation

Teamcity Unity3d Build Runner plugin

Overview

Teamcity is a continuous integration server. Unity3d is a powerful 3d game creation editor and engine. If you want to easily build Unity3d players as part of a Teamcity installation, you can invoke them from a Shell runner, but editing parameters and viewing log files is a bit of a pest.

This plugin makes life a bit easier and provides a nice cross-platform way of building Unity3d projects on the Mac or Windows platforms. (Note that the Unity3d build usually does not output any build progress to standard output but instead outputs to a log file, whose location is platform-specific)

Using

Installation

(todo: provide a prebuilt version)

Compilation

When building the plugin, you need to have downloaded the Teamcity distribution you want to build against, so that the compilation process can grab the necessary libs. It's also useful so that you can test that it will load the plugin correctly.

When running Teamcity locally, any plugins need to be installed by putting them in the .BuildServer folder. On Nix and OSX this defaults to /home//.BuildServer.

Before compiling, it's important to update the build.properties file with the paths the Teamcity distribution and to the .BuildServer folder. When the process is complete, ant should automatically copy the unityRunner.zip file to the .BuildServer folder.

Ant CLI

To compile with ant directly, just run ant dist from the root folder of the repo.

IntelliJ

Compile with IntelliJ IDEA -- the Community Edition (free) version will work!

Open up the unity_runner.ipr file, then open the Ant Build window and add build.xml (if not automatically detected).

Double click on 'dist' target to do a full build, which should produce dist/unityRunner.zip

Installing in Teamcity

Copy the unityRunner.zip file to the .BuildServer/plugins/ folder in your Teamcity installation, then restart Teamcity.

Usage

'Unity' will be available as a Build Step. It will automatically detect if Unity appears to be installed on an Agent, by looking in the default install location for each platform (Program Files or Applications).

Options

Many of these relate to Unity3d command line arguments

  • Batch Mode - should be left enabled usually, enables the Unity -batchmode
  • No graphics - on Windows only, do not initialize a graphics device during a build to avoid errors when running without a good GPU. Equivalent to -nographics command line option
  • Project path - specifies the path (relative to Working directory) of Unity project to open
  • Build Player - choose which Unity Player to build, currently supported are Web, Windows or OSX (but it would be easy to add others if required). Equivalent to passing -buildWebPlayer -buildWindowsPlayer or -buildOSXPlayer on command line
  • Execute method - specify a method for Unity to execute, to allow you to customise your build process. Equivalent to -executeMethod on the command line
  • Build path - specify the output build path for the Player
  • Clear output before - ensures output folder exists and is empty, before invoking Unity
  • Clean output after - removes any .svn and .meta files found in the output directory, as these are usually not wanted
  • Quit - specify if unity should quit after a build. Usually should be left enabled, equivalent to the -quit command line option

Features

  • Automatically locates the Unity3d log file and sends it to Teamcity whilst the build is in progress, giving feedback during the build and preventing spurious 'build is hanging' warnings from Teamcity.
  • Automatically detects if Unity3d is installed on an Agent, so prevents attempts to run if Unity3d is not installed.
  • Processes log file to detect and flag up warnings and errors to Teamcity, making log files easier to read
  • Detects compilation, asset refresh and Player statistics blocks in the log file

Contributing

Please do! Simply fork the github project as usual.

In particular in the future you may want to

  • add support for more log messages
  • build different Players
  • invoke test suites

About

A Teamcity plugin for building Unity3d projects. NOTE: this has an MIT license so feel free to copy / adapt as you need to.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%