This tool enable you stdout Unity Build log on windows, and control Timeout.
Note: Linux/macOS don't need use this tool, just pass non string with
-logfileargument to see log on stdout.
Unity Batch Build for Windows still not provide Unity Build log StdOut option, wheres macOS can check stdout with -logfile + no argument.
This small tool provide realtime stdout logging for Jenkins, VSTS and others.
Install with .NET Global Tool is the minimum cost.
dotnet tool install -g UnityBuildRunnerAlso provided as a library.
Install-Package UnityBuildRunner.CoreYou can use this tool via both CLI and Library.
$ UnityBuildRunner --help
Usage: full [options...]
Options:
-u, --unity-path <String> Full Path to the Unity.exe (Default: )
-t, --timeout <String> (Default: 00:60:00)
All you need to do is pass unity's path as -u UnityPath and leave other argments as is.
If you are running Unity batch build like this.
"C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"Then, append UnityBuildRunner --unity-path to existing command, that's all.
UnityBuildRunner --unity-path "C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"You can pass Unity Path via Argument or EnvironmentVariables.
- Argument: Add argument
--unity-path <PATH_TO_UNITY>(or-u <PATH_TO_UNITY>for short parameter). - Environment Variable: Set
UnityPathEnvironment Variable. UnityBuildRunner automatically load it if argument is not specified.
Examples
Pass Unity Path via Argument --unity-path.
UnityBuildRunner --unity-path "C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"Pass Unity Path via EnvironmentVariables UnityPath.
set UnityPath=C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe
UnityBuildRunner -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"You can use this library as your tool chain.
IBuilder builder = new Builder(logger);
ISettings settings = Settings.Parse(args, @"C:\Program Files\Unity\Hub\Editor\2021.3.11f1\Editor\Unity.exe");
builder.BuildAsync(settings, TimeSpan.FromMinutes(30));- dotnet global command
- core logic as nuget