Unity command line builder. Flexible setup through Environment variables in combination with command line variables. Well combined with Fastlane.
All operation systems are supported for running the build process:
- ✅ Windows
- ✅ MacOS
- ✅ Linux
Supported platforms:
- ✅ Standalone (Windows / Mac / Linux)
- ✅ iOS
- ✅ Android
- 🟡 other (supported but not tested)
- Install OpenUPM-CLI
- Open command line in Unity project folder
openupm add extensions.unity.ubuilder
- Add this code to
/Packages/manifest.json
{
"dependencies": {
"extensions.unity.ubuilder": "1.2.0",
},
"scopedRegistries": [
{
"name": "Unity Extensions",
"url": "https://registry.npmjs.org",
"scopes": [
"extensions.unity"
]
}
]
}Any variable can be passed as argument in command line such as output=./Builds/Destination or it could be set as environment variable in command line or in operation system or even in docker.
In command line you can do this by this command
SET output=./Builds/Destination on Windows
output=./Builds/Destination on MacOS and Linux
| Variable | Type | Default | Description |
|---|---|---|---|
output |
string | null |
absolute or relevant path to build destination |
buildNumber |
integer | timestamp |
integer value of build number |
buildVersion |
string | current version | build version, should contains only numbers and dots, last and first characters should be numbers |
developmentBuild |
boolean | current value | true/false, enable or disable Unity project flag - Development Build |
| Variable | Type | Default | Description |
|---|---|---|---|
ios_SigningTeamId |
string | current value | Apple signing team ID |
ios_EnableAutomaticSigning |
boolean | current value | true/false, automatic signing build |
| Variable | Type | Default | Description |
|---|---|---|---|
android_BUILD_APP_BUNDLE |
string | current value | true/false, true - compile .aab file for Google Play, false - compile .apk |
android_KEYSTORE_PATH |
boolean | null |
[required] path to keystore |
android_KEYSTORE_PASSWORD |
boolean | null |
[required] keystore password |
android_KEYALIAS_NAME |
boolean | null |
[required] key alias |
android_KEYALIAS_PASSWORD |
boolean | null |
[required] key alias password |
Tip: If you don't have Unity Pro license that allow you to run Unity in batchmode (no GUI), you can use Unity Personal license. In this case you should run Unity Editor with GUI and it will build project. Just need to remove
-batchmode -nographicsfrom command line.
UnityEditor=/Applications/"Unity Editor"/2019.2.1f1/Unity.app/Contents/MacOS/Unity
"$UnityEditor" -projectPath ./ -logFile build.log -executeMethod UBuilder.CommandiOS.Build -quit -accept-apiupdate -quitTimeout 6000 -batchmode -nographicsUnityEditor=/Applications/"Unity Editor"/2019.2.1f1/Unity.app/Contents/MacOS/Unity
android_KEYSTORE_PATH=***************
android_KEYSTORE_PASSWORD=***************
android_KEYALIAS_NAME=***************
android_KEYALIAS_PASSWORD=***************
"$UnityEditor" -projectPath ./ -logFile build.log -executeMethod UBuilder.CommandAndroid.Build -quit -accept-apiupdate -quitTimeout 6000 -batchmode -nographicsUnityEditor=/Applications/"Unity Editor"/2019.2.1f1/Unity.app/Contents/MacOS/Unity
"$UnityEditor" -projectPath ./ -logFile build.log -executeMethod UBuilder.Command.Build -quit -accept-apiupdate -quitTimeout 6000 -batchmode -nographicsOr create .sh file and put the text inside. Ease way to start build process by single script.
SET UnityEditor=C:/UnityEditor/Unity/2019.2.1f1/Editor/Unity.exe
SET android_BUILD_APP_BUNDLE=false
SET android_KEYSTORE_PATH=***************
SET android_KEYSTORE_PASSWORD=***************
SET android_KEYALIAS_NAME=***************
SET android_KEYALIAS_PASSWORD=***************
%UnityEditor% -projectPath ./ -logFile build.log -executeMethod UBuilder.CommandAndroid.Build -quit -accept-apiupdate -quitTimeout 6000 -batchmode -nographicsSET UnityEditor=C:/UnityEditor/Unity/2019.2.1f1/Editor/Unity.exe
%UnityEditor% -projectPath ./ -logFile build.log -executeMethod UBuilder.Command.Build -quit -accept-apiupdate -quitTimeout 6000 -batchmode -nographicsOr create .bat file and put the text inside. Double click the bat file. Ease way to start build process by single script
| Function | Description |
|---|---|
UBuilder.CommandiOS.Build() |
create XCode project (MacOS required) |
UBuilder.CommandAndroid.Build() |
create APK (android_BUILD_APP_BUNDLE=false) or AAB (android_BUILD_APP_BUNDLE=true) file |
UBuilder.CommandAndroid.Export() |
create Android Studio project |
UBuilder.Command.Build() |
build current (from ProjectSettings) platform build |
Press File/UBuilder and choose needed build options from the list.
Before execute the UBuilder functions, prepare a project to build. You can do that by creating public static class with public static method. In that method you should prepare your project and call needed UBuilder function. In command line call your new public static function instead of UBuilder function. Example:
public static class ProjectBuilder
{
// customize package name (bundle id)
[MenuItem("File/UBuilder/Build Android custom package")]
public static void BuildiOSCustomPackage()
{
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, "my.project.game");
UBuilder.CommandiOS.Build();
}
// customize package name (bundle id)
[MenuItem("File/UBuilder/Build Android+iOS custom package")]
public static void BuildiOSAndroidCustomPackage()
{
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, "my.project.game");
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, "my.project.game");
UBuilder.CommandiOS.Build();
UBuilder.CommandAndroid.Build();
}
}SET UnityEditor=C:/UnityEditor/Unity/2019.2.1f1/Editor/Unity.exe
%UnityEditor% -projectPath ./.. -logFile build.log -executeMethod BuildProject.BuildiOSCustomPackage -quit -accept-apiupdate -quitTimeout 6000 -batchmode -nographics output=Builds/iOS_Custom_Package