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, IPostprocessBuildWithReportImplements: IPreprocessBuildWithReport, IPostprocessBuildWithReport, IOrderedCallback
Remarks
BuildPlatform serves two purposes:
Build Pipeline Hooks — Pre-build processing copies Odin's
link.xmlintoAssets/Buildto prevent IL2CPP stripping. Post-build processing is a no-op placeholder.Menu Commands — Provides
Build/Standalone OSXandBuild/Clear Build Cachemenu items for development builds.
Pre-Build Processing
Before each build, the preprocessor:
Creates
Assets/Buildfolder if it doesn't existCopies Odin Serializer's
link.xmlfromSirenixAssetPaths.SirenixAssembliesPathtoAssets/BuildIf either operation fails, throws
BuildFailedExceptionto halt the build
Post-Build Cleanup
After the build completes, the BuildStandaloneOSX method calls ClearTempFiles(), which:
Deletes all files and subdirectories in
Assets/BuildRemoves the
Assets/Buildfolder from the AssetDatabaseRefreshes the AssetDatabase
Development Build Options
The default build options are configured for development workflows:
Development— enables development build modeAutoRunPlayer— automatically runs the built playerShowBuiltPlayer— reveals the build in the file explorerAllowDebugging— enables script debuggingWaitForPlayerConnection— waits for debugger/profiler connection
Quick Lookup
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
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:
Collects all enabled scenes from
EditorBuildSettings.scenesSets build target to
StandaloneOSXwithStandalonetarget groupSets output path to
ParagonPaths.Project.Build/Application.productNameCalls
BuildPipeline.BuildPlayerCalls
ClearTempFiles()to removeAssets/BuildRefreshes the AssetDatabase
ClearBuildCache (private static)
Deletes the entire build output directory and temp build assets.
Behavior:
Deletes
ParagonPaths.Project.Builddirectory and all contents (if it exists)Clears
Assets/Buildtemp files (if the folder exists)Logs "Cleared build cache." on success
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
build_options
BuildOptions
Development | AutoRunPlayer | ShowBuiltPlayer | AllowDebugging | WaitForPlayerConnection
Default options for development builds
Common Pitfalls
macOS-only build target BuildStandaloneOSX is hardcoded for BuildTarget.StandaloneOSX. For other platforms, additional menu items or a platform selection dialog would be needed.
Depends on Odin Serializer paths The pre-build step copies link.xml from SirenixAssetPaths.SirenixAssembliesPath. If Odin Inspector/Serializer is not installed or the path changes, the build will fail with BuildFailedException.
ClearBuildCache deletes without confirmation Both ClearBuildCache and ClearTempFiles delete files immediately without a confirmation dialog. Ensure build outputs are backed up or committed before clearing.
Build options are development-only The default build_options include Development, AllowDebugging, and WaitForPlayerConnection. These are not suitable for release builds. A separate release build configuration would be needed for production.
See Also
Build Overview — system overview
ParagonPaths — provides
Project.BuildandAssets.BuildpathsParagon Editor Overview — editor system overview
Last updated