I’m trying to autmate the build process and I have the following problem:
When calling BuildPipeline.BuildPlayer it expects a BuildPlayerOptions object with a BuildOptions field. I would like to fill this field with the currently selected items in the BuildSettings window.
Previousely EditorUserBuildSettings.architectureFlags was used for this, however this is now no longer part of Unity.
The BuildSettings window settings also don’t seem to be saved in the EditorBuildSettings.asset file in the ProjectSettings window, so parsing the YAML file is also out of the question.
Essentially I would like to do something like this:
BuildPlayerWindow.DefaultBuildMethods.GetBuildPlayerOptions()(source) might be what you’re looking for. It calls the internal function GetBuildPlayerOptionsInternal() and will always open a window prompting for a output directory. GetBuildPlayerOptions() takes a “default” instance of BuildPlayerOptions as a parameter, but you can pass a new instance if you don’t have any specific options you’d like to provide as default.
If you don’t mind being prompted for a build folder, your GetCurrentBuildOptions() method could look something like this:
As always with reflection, be aware that the internal method signature is subject to change, and may cause your build scripts to break in future editor versions.
@Minchuilla’s addition is still working as of 2019.4.4f1.
It kills me that turning off Development Build doesn’t turn off the #DEVELOPMENT_BUILD define. What a weird thing not to do…? I’m trying to have a dynamic build path for Addressable content bundles and this has been one of the hardest parts!