Proper usage of EditorUserBuildSettings and BuildOptions

Hey all,

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;
    BuildTarget customBuildTarget=EditorUserBuildSettings.activeBuildTarget;
    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


more ▼

asked May 11, 2012 at 08:13 PM

equalsequals gravatar image

5.2k 32 42 87

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

for this particular script, I think you could add this line up top:

EditorUserBuildSettings.architectureFlags = EditorUserBuildSettings.architectureFlags | BuildOptions.AcceptExternalModificationsToPlayer;
more ▼

answered Jun 28, 2013 at 07:34 PM

Matt(Trip)Maker gravatar image

16 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: May 11, 2012 at 08:13 PM

Seen: 1684 times

Last Updated: Jun 28, 2013 at 07:34 PM