I'm trying to automate our build process here a little, and I'm not sure I truly understand the proper usage of EditorUserBuildSettings and BuildOptions. Here is a very basic implementation of what I am trying to achieve, hopefully it is enough to get my point across:
Note: it should be implied that for this example I am functioning under iOS build settings.
EditorUserBuildSettings.appendProject = true; //if we're building iOS, insure we're always appending and not building fresh every time.
BuildOptions customBuildOptions = EditorUserBuildSettings.architectureFlags;
string savepath = EditorUtility.SaveFolderPanel("Build "+customBuildTarget, EditorUserBuildSettings.GetBuildLocation(customBuildTarget), "");
if(savepath.Length != 0)
string dir=System.IO.Path.GetDirectoryName(savepath); //get build directory
string scenes=new string[EditorBuildSettings.scenes.Length];
for(int i=0;i < EditorBuildSettings.scenes.Length; ++i)
// Do some preprocess stuff right here
EditorUserBuildSettings.SetBuildLocation(customBuildTarget,dir); //store new location for this type of build
BuildPipeline.BuildPlayer(scenes, savepath, BuildTarget.iPhone, customBuildOptions);
// Do some posprocess stuff right here
My expectations are that the XCode project will be appended - however it does not seem like that is the case, it writes a fresh project to my specified directory every time I run the script.
I tried scouring the docs but, as with most of the Editor API, documentation is really non-existant and lacking any form of example.
Thanks in advance
Answer by Matt(Trip)Maker
Jun 28, 2013 at 07:34 PM
for this particular script, I think you could add this line up top:
EditorUserBuildSettings.architectureFlags = EditorUserBuildSettings.architectureFlags | BuildOptions.AcceptExternalModificationsToPlayer;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
5 People are following this question.
Unity PreBuild Step for Custom Plugins
Editor Script: Build for multiple platforms at once.
Why does my prefab create a child by itself in ProjectView
Build Player from Command Line
Set prefab to public variable of another script