Joris Eijmberts

Turning crazy ideas into games!

Building via Editor scripts

Building in unity is done using the Unity Build player pipeline, normally you use the default unity build menu to create build. But if you need a custom configuration to create a build it’s possible to create builds using build scripts.

Unity build menu

By default when using the Unity build menu, CP Social would be correctly compiled with the right assemblies for the selected target platform. But to be able to create a build ‘only’ containing the Unsupported platform an no other platforms, the custom build pipeline had to be used.

Unity build menu

Scripts

Build script a code file that are execute by the unity editor that contain custom logic for building a player in Unity. By utilizing these scripts it’s possible to alter configurations within Unity before the build process starts.

Portion of CP Social’s build script

Why?

By utilizing build scripts it’s possible to create a build for a target platform that isn’t currently selected in the build menu which in turn, skips the process of having to re-import a lot of assets resulting in faster build times.

Further more it’s possible to execute these scripts straight from a custom menu item in the unity editor. Shown in the image below.

CP Social’s included build menu

By using build scripts I was also able to chain builds together. Instead of selecting a build target in the build menu, I chained the build script together enabling the possibility to create a build for all platforms supported by CP Social with their own configuration and correctly set pre-processor directives all at once without any user interaction in between each build. The usage of these build script was useful to create a CP Social unsupported standalone build

Example

Below is a video that shows these build scripts in action, it builds all CP Social supported platforms in one go, without any user interaction in between.

CP Social build scripts all in one