Search Unity

Why does Unity recompile all scripts after creating a standalone build?

Discussion in 'Editor & General Support' started by Zaikman, Feb 19, 2014.

  1. Zaikman

    Zaikman

    Joined:
    Aug 2, 2011
    Posts:
    17
    I've written an editor script which automates several steps in a custom build process. After building the player itself, I kick off two BackgroundWorkers to zip up the generated build and then FTP upload it to a server. For the zipping task, I'm using the 7z executable stored in the Unity Editor's data path. Because it takes a while for it to finish, I start a new Process within the BackgroundWorker thread and then call WaitForExit() on it; when that finally returns, it continues on to the uploading task.

    Here's the problem. After calling BuildPipeline.BuildPlayer(), it immediately kicks off the BackgroundWorker and starts zipping the build. At the same time, the 'busy' icon in the bottom right corner of the editor starts spinning as if it's recompiling all of the scripts in the project. Sure enough, when it finishes some six seconds later, it goes through the whole unload/reload of Mono, killing off the BackgroundWorkers and halting the task. The 7z process finishes running, but it never advances on to the uploading step because the BackgroundWorker is now dead.

    Is this a new 'thing' or a bug? I don't remember Unity ever recompiling scripts post-build for any reason.