Editor script to avoid pointless dialogs

Open a project in Unity3d, bring up the Build Settings box. Click Build.

Note that …

(1) Unity brings up a dialog saying “Save As:” (you type in say “Sunday”) and “Where” (you select a folder)

You hit enter to select the default, “Save” and …

(2) Unity utterly pointlessly brings up a dialog “Warning. Build folder already exists. Would you like to … replace it?”

You click “Replace” (you can’t just hit Enter, since, the default is “Cancel”)

My dear friends who are experts in Scripting the Editor:

(A) would it be possible to essentially eliminate the dialog at (2), make it always just “Replace” with no comment,

even better,

(B) could one just set somehow, once, a folder (say, “Desktop/Build”) and the dialog at (1) would never exist. It would always just build to “~/Desktop/Build” and that would be that (yes – Replacing! that folder! heh)

(Perhaps you’d have to replace with a new build process or something?)

Is this possible, Editor Scripting experts, or are these two challenges totally outside the Editor Scripting universe? Thank you !!!

There is no way to edit the existing dialoge, but it’s possible to either make your own or just eliminate the dialoge completely with the script example on this page. I recommend setting up a MenuItem keyboard shortcut and keeping your build settings in the script file or a non-versioned config file if you’re working on a team.

http://unity3d.com/support/documentation/ScriptReference/BuildPipeline.BuildPlayer.html