OnPostprocessBuild from IPostprocessBuildWithReport is not called on failed builds

Bug:
OnPostprocessBuild from IPostprocessBuildWithReport not called on failed builds

Expected:
OnPostprocessBuild from IPostprocessBuildWithReport is called even on failed builds.

Reproduce:
I let my player fail by building a scripts only build while i changed from mono to il2ccp backend.
(getting:
BuildFailedException: Build path contains a project previously built with the Mono2x scripting backend, the current setting is for IL2CPP
Please use an alternative destination, change the configured scripting backend or select ā€˜Clean Buildā€¦ā€™
UnityEditor.WindowsStandalone.WinPlayerPostProcessor.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at :0)
UnityEditor.PostprocessBuildPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target) (at :0)
UnityEditor.GenericMenu:CatchMenu(Object, String[ ], Int32)
)

Also call custom OnPostprocessBuild on IPostprocessBuildWithReport implementers so that cleanup tasks can be performed.

1 Like

I dunno about ā€œbugā€ manā€¦ itā€™s pretty explicit in the docs:

Implement this interface to receive a callback after the build is complete.

In my corner of the universe a failed build would never be considered ā€œcomplete.ā€

Well, thank God we do not exist in your corner of the universe. It couldnā€™t get any more explicit than that, that this method should be called regardless of the result of the build.
9561493--1352023--upload_2024-1-4_15-3-55.png

2 Likes