developer.thiggins.com | PostprocessBuildPlayer
PostprocessBuildPlayer
Last Updated: January 8, 2008

One great feature of Unity is the fact that it allows you to write and include a PERL script within your project folder and have that script executed every time you make a build. The PERL script is executed after the build process is complete and it's passed a number of arguments that provide information about the build that was just completed. For reference, this feature is covered in the documentation under the heading Build Player Pipeline. This feature is interesting and useful because PERL scripts can be quite robust in terms of their file handling and manipulation and therefore they can be used to create customized build behavior. Here you'll find the PERL script that I'm currently writing, for now it only offers customized web player building but I plan on adding support for the other build targets as time goes on.

Usage Instructions
Here are some simple usage instructions:
  1. Download the zip file appropriate for your version of Unity and open it to locate the editor package file.
     
  2. Launch Unity and open your project.
     
  3. Double-click the editor package file to import the files into an Editor folder within your project's Assets folder.
     
  4. Build a web player and see the script in action.
What Will Happen
When you create a web player build, the following will occur after Unity has created the web player data file and HTML page:
  1. The default HTML file created by Unity will be deleted.
     
  2. A new HTML file will be created using the custom template found within the Editor folder.
     
  3. That custom template uses a number of external files, including a JavaScript file and a few custom images, all supporting files will be copied into place next to the web player build filed.
Note: this script will break the 'Build & Run' feature of Unity because it deletes the originally created HTML file in order to replace it with a custom file.

Please open and inspect the PostprocessBuildPlayer PERL file for some insight into how the script works and what customized behavior it can offer.

 
Contact Me