I have a cross-platform game that I want to build automatically for iOS and Android. My build machine is a Mac Mini, but I would like to be able to build on multiple machines using Jenkins. At this point, I have scripts set up that make the Android build nicely, but there is a lot of interactive preparation that I was hoping to avoid through automation.
The big hangup right now is this: whenever I have a “clean workspace”, the editor seems to try and build “PC, Mac & Linux Standalone”. This leads to compilation errors regarding conditionally-compiled blocks (#if UNITY_IPHONE
and so on).
If I manually fire up Unity once in that folder and use the “Switch Platform” button from the Build Settings panel, all subsequent automated builds work just fine.
Is there any way to do the same thing as “Switch Platform” from the command line? I am using something like the AutoBuilder script from http://wiki.unity3d.com/index.php?title=AutoBuilder with “executeMethod” from the command line. The script has a line to switch target, but maybe it is not effective:
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.Android);
BuildPipeline.BuildPlayer(scenes, path, BuildTarget.Android, BuildOptions.None);
The command line I am using is:
Unity -batchmode -quit -executeMethod Builder.Android -projectPath ./proj -logfile unity_build_log.txt
Do I need to do anything more than that?