Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

IPostprocessBuildWithContext.OnPostprocessBuild

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void OnPostprocessBuild(Build.BuildCallbackContext ctx);

Parameters

Parameter Description
ctx A context containing information about the build, such as its build report.

Description

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

This callback is invoked during Player builds or AssetBundle builds. This callback is invoked even when the build stops early due to a failure or cancellation. However it will not be invoked if initial validation checks prevent the build from starting.

Additional resources: BuildPipeline.BuildPlayer, BuildPipeline.BuildAssetBundles, IPreprocessBuildWithContext

using UnityEditor;
using UnityEditor.Build;
using UnityEngine;
using UnityEditor.Build.Reporting;

class MyCustomBuildProcessor : IPostprocessBuildWithContext { public int callbackOrder { get { return 0; } } public void OnPostprocessBuild(BuildCallbackContext ctx) { if (ctx.IsContentOnlyBuild) Debug.Log("AssetBundle build: MyCustomBuildProcessor.OnPostprocessBuild for target " + ctx.Report.summary.platform + " at path " + ctx.Report.summary.outputPath); else if (ctx.IsPlayerBuild) Debug.Log("Player build: MyCustomBuildProcessor.OnPostprocessBuild for target " + ctx.Report.summary.platform + " at path " + ctx.Report.summary.outputPath); } }