unity-azure-pipelines-tasks
unity-azure-pipelines-tasks copied to clipboard
Unity Build Task runs forever after `BuildPlayer` C# call completes
Hi! I'm trying to setup an automated build process. The agent doesn't have a GPU, so I'm passing the -nographics
flag using the custom command arguments, which is correctly passed on to the process. However, Unity still tries to bake Ambient Probes and then does nothing for over an hour. Here's the last few messages:
/* ... */
COMMAND LINE ARGUMENTS:
C:\Program Files\Unity\Hub\Editor\2021.1.3f1\Editor\Unity.exe
-batchmode
-buildTarget
Android
-projectPath
C:\agent\_work\2\s
-logfile
C:\agent\_work\2\s\Logs\UnityBuildLog_2021-09-16-11-10-42.log
-nographics
-outputDirectory
BuildExport/AndroidStudio
-executeMethod
BuildSpotARModule.BuildAndroidStudioProject
Successfully changed project path to: C:\agent\_work\2\s
C:/agent/_work/2/s
Using Asset Import Pipeline V2.
/* a bunch of import and compilation work happens */
DisplayProgressbar: Exporting project
Android PostProcess task "Exporting project" took 887.5196 ms
NullReferenceException: Object reference not set to an instance of an object
at Unity.VisualScripting.BoltCore.get_Paths () [0x00000] in C:\agent\_work\2\s\Library\PackageCache\[email protected]\Editor\VisualScripting.Core\Plugin\BoltCore.cs:41
at Unity.VisualScripting.AotPreBuilder.get_linkerPath () [0x00000] in C:\agent\_work\2\s\Library\PackageCache\[email protected]\Editor\VisualScripting.Core\Platforms\AotPreBuilder.cs:28
at Unity.VisualScripting.AotPreBuilder.DeleteAotStubs () [0x00000] in C:\agent\_work\2\s\Library\PackageCache\[email protected]\Editor\VisualScripting.Core\Platforms\AotPreBuilder.cs:85
at Unity.VisualScripting.AotPreBuilder.OnPostProcessBuild (UnityEditor.BuildTarget target, System.String pathToBuiltProject) [0x00000] in C:\agent\_work\2\s\Library\PackageCache\[email protected]\Editor\VisualScripting.Core\Platforms\AotPreBuilder.cs:40
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
at UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnPostprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x00034] in <1798d6bccd2b44b2854be2fbcc2463b3>:0
at UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass17_0.<OnBuildPostProcess>b__1 (UnityEditor.Build.IPostprocessBuildWithReport bpp) [0x00000] in <1798d6bccd2b44b2854be2fbcc2463b3>:0
at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) [0x000ff] in <1798d6bccd2b44b2854be2fbcc2463b3>:0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPostProcess(BuildReport)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[])
(Filename: Library/PackageCache/[email protected]/Editor/VisualScripting.Core/Plugin/BoltCore.cs Line: 41)
Refreshing native plugins compatible for Editor in 1.18 ms, found 1 plugins.
Preloading 0 native plugins for Editor in 0.00 ms.
/* ... */
DisplayProgressNotification: Build Successful
Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
Loaded scene 'Temp/__Backupscenes/0.backup'
Deserialize: 0.666 ms
Integration: 230.129 ms
Integration of assets: 0.004 ms
Thread Wait Time: 26.277 ms
Total Operation Time: 257.077 ms
System memory in use before: 141.1 MB.
System memory in use after: 141.3 MB.
Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 3631.
Total: 503.520300 ms (FindLiveObjects: 0.422400 ms CreateObjectMapping: 0.261600 ms MarkObjects: 502.810100 ms DeleteObjects: 0.023100 ms)
Build report: True /* this log is from our custom unity C# build script, so the build should actually be finished at this point */
Microsoft Media Foundation video decoding to texture disabled: graphics device is Null, only Direct3D 11 and Direct3D 12 (only on desktop) are supported.
[Project] Loading completed in 283.219 seconds
Project init time: 0.000 seconds
Template init time: 0.000 seconds
Package Manager init time: 0.000 seconds
Asset Database init time: 0.000 seconds
Global illumination init time: 0.000 seconds
Assemblies load time: 0.000 seconds
Unity extensions init time: 0.000 seconds
Asset Database refresh time: 0.000 seconds
Scene opening time: 160.367 seconds
[00:00:00] Enlighten: Builtin Sky manager started.
[MODES] ModeService[none].Initialize
[MODES] ModeService[none].LoadModes
[MODES] Loading mode Default (0) for mode-current-id-XXX
[UnityConnectServicesConfig] config is NOT valid, switching to default
[00:00:02] Enlighten: Finished 1 Bake Ambient Probe job (0.00s execute, 0.00s integrate, 1.53s wallclock)
Starting cubemap convolution for '' (size 128)
...took 0.856 seconds
Then, nothing happens for over an hour. Azure cancels the build. I'm using a custom C# build script:
var buildTarget = EditorUserBuildSettings.activeBuildTarget;
var scenePaths = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path);
var buildError = BuildPipeline.BuildPlayer(scenePaths.ToArray(), targetDir, buildTarget, buildOptions);
Console.WriteLine("Build report:");
Console.WriteLine(buildError);
Anyone got an idea what is going wrong?
It seems like the -quit
flag has not been passed to Unity. Is the UnityBuildTaskV3
not passing the -quit
flag by default?
Passing the -quit
flag using the additional command line arguments solved the issue, but this should probably not be necessary