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.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
5 People are following this question.
Editor Script: Build for multiple platforms at once.
Unity PreBuild Step for Custom Plugins
How do I release editor memory?
Create mesh by defining points
Add/Remove scene to build settings from editor script and run levels in editor