Skip to content

Instantly share code, notes, and snippets.

@sassembla
Last active December 15, 2015 03:29
Show Gist options
  • Save sassembla/5194684 to your computer and use it in GitHub Desktop.
Save sassembla/5194684 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
using System.Collections;
public class BuildBatch : MonoBehaviour {
// build iOS app
private static void BuildiOS(){
Debug.Log("/////////// build start ///////////");
string [] scene = {
"Assets/SampleAsset.unity"
};
string dstDevice = "Device";
string dstSimulator = "Simulator";
BuildOptions opt = BuildOptions.SymlinkLibraries |
BuildOptions.Development |
BuildOptions.ConnectWithProfiler |
BuildOptions.AllowDebugging;
// set cheched
EditorUserBuildSettings.symlinkLibraries = true;
EditorUserBuildSettings.development = true;
//set Build-target : Device
PlayerSettings.iOS.sdkVersion = iOSSdkVersion.DeviceSDK;
//BUILD for device
string errorMsg_Device = BuildPipeline.BuildPlayer(scene, dstDevice, BuildTarget.iPhone, opt);
if (string.IsNullOrEmpty(errorMsg_Device)){
Debug.Log("/////////// device build succeeded ///////////");
} else {
Debug.Log("/////////// device build failure ///////////");
Debug.LogError(errorMsg_Device);
}
//set Build-target : Simulator
PlayerSettings.iOS.sdkVersion = iOSSdkVersion.SimulatorSDK;
// BUILD for simulator
string errorMsg_Simulator = BuildPipeline.BuildPlayer(scene, dstSimulator, BuildTarget.iPhone, opt);
if (string.IsNullOrEmpty(errorMsg_Simulator)){
Debug.Log("/////////// simulator build succeeded ///////////");
} else {
Debug.Log("/////////// simulator build failure ///////////");
Debug.LogError(errorMsg_Simulator);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment