- Home /
Changing Build Settings by code
One of the repetitive tasks I wish to avoid, is manually updating the version number in the build settings every time I build.
Is there a way to update this value by code? I found PlayerSettings.bundleVersion, but not sure how to use it so it updates before each build. I wish to do something like:
static void CallMeBeforeBuild() {
PlayerSettings.bundleVersion = MetaData.version;
// MetaData is my own static class
}
I also found the manual for post processing script, but I am not sure this is what I need.
:) I guess I edited the question while you were commenting. Yeah, found that. But not sure now where to put it so it is automatically called on each build. See the updated question.
I used to trigger it manually (via $$anonymous$$enuItem
), as PostProcessSceneAttribute
is not yet working properly on 4.2 (i.e. does not execute before building, at least not in mobile platforms). Just use PlayerSettings.bundleVersion (note that you can get and set this value)
Well, updating it by menu item is almost as labor intensive as editing it in the player settings... :)
Yeah... A bit faster if you create a shortcut for it. Hope they fix PostProcessSceneAttribute
soon.
Answer by kork · Sep 02, 2013 at 01:27 PM
You could do without scripting using the uTomate extension. With this you can set up an automation plan, where you first set up the player settings and then build your player(s). Then you can run the plan with a single click.
Thanks for the plugin reference, may become handy some time, but it is way over the top for what I need.
Your answer
Follow this Question
Related Questions
Unity Builds Old Version of my Scene 1 Answer
different project for different platforms 0 Answers
Set Bundle Version Code through editor script 3 Answers
Distribute terrain in zones 3 Answers
Dialog Box in Build Settings 1 Answer