Simple build utility for Unity
- Open the Package Manager window in the Unity Editor.
- Click "Add package from git URL".
- Type
https://github.com/AndrewMJordan/build-utility.git#upm
then press enter.
Invoke unity.exe
and use the executeMethod
option to execute the build utility:
Andtech.BuildUtility.Builder.Build [-output <DIRECTORY] [-name <NAME>]
- Run unity.exe with the
executeMethod
option.
> unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build
- Use the
revision
option if you want a revision string available in your build. For example, your CI/CD pipeline can include the commit hash in each build.
> unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -revision ca82a6df
- Use the
output
option to build to the specified directory.
> unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -output $HOME
- Use the
name
option to give an explicit name to your build. (If you omit the extension, an extension will automatically be added based on the build target)
> unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -name MyBuild
> unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -name MyAndroidApp.apk
> unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -name MyAndroidApp
- Access the revision string via
BuildVersioner
.
if (BuildVersioner.TryReadVersionFile(out var versionInfo)) {
string version = versionInfo.RawVersion;
string revision = versionInfo.Revision;
Debug.Log($"Build {version} (Revision: {revision})");
}
- From the Package Manager window, import the Version Label sample.
- Add the VersionLabel prefab to a canvas in your scene.
- When your project is build, version information will be displayed on-screen.