BuildPlatform

Build pipeline processor that handles pre/post-build steps and provides menu-driven build commands. Implements Unity's IPreprocessBuildWithReport and IPostprocessBuildWithReport interfaces to hook into the build pipeline.

Definition

Namespace: Paragon.Editor Assembly: Paragon.Editor.dll

public class BuildPlatform : IPreprocessBuildWithReport, IPostprocessBuildWithReport

Implements: IPreprocessBuildWithReport, IPostprocessBuildWithReport, IOrderedCallback

Remarks

BuildPlatform serves two purposes:

  1. Build Pipeline Hooks — Pre-build processing copies Odin's link.xml into Assets/Build to prevent IL2CPP stripping. Post-build processing is a no-op placeholder.

  2. Menu Commands — Provides Build/Standalone OSX and Build/Clear Build Cache menu items for development builds.

Pre-Build Processing

Before each build, the preprocessor:

  1. Creates Assets/Build folder if it doesn't exist

  2. Copies Odin Serializer's link.xml from SirenixAssetPaths.SirenixAssembliesPath to Assets/Build

  3. If either operation fails, throws BuildFailedException to halt the build

Post-Build Cleanup

After the build completes, the BuildStandaloneOSX method calls ClearTempFiles(), which:

  1. Deletes all files and subdirectories in Assets/Build

  2. Removes the Assets/Build folder from the AssetDatabase

  3. Refreshes the AssetDatabase

Development Build Options

The default build options are configured for development workflows:

  • Development — enables development build mode

  • AutoRunPlayer — automatically runs the built player

  • ShowBuiltPlayer — reveals the build in the file explorer

  • AllowDebugging — enables script debugging

  • WaitForPlayerConnection — waits for debugger/profiler connection

Quick Lookup

Goal
How

Build for macOS

Menu: Build/Standalone OSX

Clear build artifacts

Menu: Build/Clear Build Cache

Build output location

ParagonPaths.Project.Build / Application.productName

Callback order

0 (default priority)

Properties

Property
Type
Access
Description

callbackOrder

int

explicit (IOrderedCallback)

Returns 0 — default build callback priority

Methods

OnPreprocessBuild (explicit interface)

Copies Odin's link.xml to Assets/Build before the build starts.

Throws: BuildFailedException — if folder creation or file copy fails.

OnPostprocessBuild (explicit interface)

Post-build hook. Currently a no-op.

BuildStandaloneOSX (private static)

Builds a standalone macOS player with all enabled scenes from EditorBuildSettings.

Behavior:

  1. Collects all enabled scenes from EditorBuildSettings.scenes

  2. Sets build target to StandaloneOSX with Standalone target group

  3. Sets output path to ParagonPaths.Project.Build / Application.productName

  4. Calls BuildPipeline.BuildPlayer

  5. Calls ClearTempFiles() to remove Assets/Build

  6. Refreshes the AssetDatabase

ClearBuildCache (private static)

Deletes the entire build output directory and temp build assets.

Behavior:

  1. Deletes ParagonPaths.Project.Build directory and all contents (if it exists)

  2. Clears Assets/Build temp files (if the folder exists)

  3. Logs "Cleared build cache." on success

  4. Logs the exception if deletion fails

ClearTempFiles (private static)

Deletes all files and subdirectories in Assets/Build, then removes the folder from the AssetDatabase.

Constants

Constant
Type
Value
Description

build_options

BuildOptions

Development | AutoRunPlayer | ShowBuiltPlayer | AllowDebugging | WaitForPlayerConnection

Default options for development builds

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated