Skip to content

Instantly share code, notes, and snippets.

@allisonsalmon
Created May 9, 2013 18:05
Show Gist options
  • Save allisonsalmon/5549298 to your computer and use it in GitHub Desktop.
Save allisonsalmon/5549298 to your computer and use it in GitHub Desktop.
Some basics on setting up an auto builder for Unity 3D
This is a basic example of how to set up an autobuilder for Unity 3D.
The Build.sh is an example of a shell script used to kick off the build. This assumes use of the Asset Server. If you are using another version control system you will want to add a command to sync before you preform the build command. Obviously, change the paths to conform to your own project. Set this script up to run as a cron job.
The Autobuilder.cs is an example of setting up a simple function that gets called as part of the build process. You can build multiple platforms this way or pretty much do any kind of pre-build stuff you might need to do (like if you have assets that are optimized for specific platforms and such). This should go in your Unity project with other Editor scripts.
using UnityEditor;
using System.Collections;
public class Autobuilder {
static void PerformBuild()
{
string [] scenes = { @"Assets/Scenes/Main Game.unity",
@"Assets/Scenes/Main Menu.unity",
@"Assets/Scenes/Locations/Office.unity",
@"Assets/Scenes/Locations/SheilasLab.unity",
@"Assets/Scenes/Locations/Union.unity",
@"Assets/Scenes/Locations/Conference.unity",
@"Assets/Scenes/Locations/BarberShop.unity"};
BuildPipeline.BuildPlayer(scenes, "fairplay_autobuild_osx.app", BuildTarget.StandaloneOSXIntel, BuildOptions.None);
BuildPipeline.BuildPlayer(scenes, "fairplay_autobuild_web", BuildTarget.WebPlayer, BuildOptions.None);
}
}
#!/bin/sh
/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -logFile /AutoBuild/Fairplay/autobuildlog.txt -projectPath /AutoBuild/Fairplay -assetServerUpdate unityasset.morgridge.net "PathfinderV4" Autobuilder buildme -executeMethod Autobuilder.PerformBuild -quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment