- Home /
How to build from script while using build settings from editor?
I want to perform some things everytime I make a build, but I don't want to change the build settings. Basically I want to be able to change a setting in Editor's Build Settings window (say, change target platform from PC to Android), than close the Build Settings Window and run my custom build script, which performs my custom stuff and than makes a build with settings I've just set in Build Settings window. I tried to do this with this script:
[MenuItem("Tools/Custom Builder/Build Game")]
static void BuildGame()
{
//Doing some stuff here
BuildPlayerOptions options = new BuildPlayerOptions();
BuildPipeline.BuildPlayer(options);
}
but it requires me to assign values into BuildPlayerOptions params. How can I use the values from Build Settings window for that?
I think you would have to look into the code on what allows the platform to be switched when you build your game, then use that code for your script
I am not sure what you mean by
the code on what allows the platform to be switched when you build your game