How to create Build from script?

I have grown tired of opening the build dialog and creating a new folder manually whenever I want to make a build

How can I automate this for example so that I only have to press a hotkey to trigger an editor script?

for example I could have a game object with a script build manager which holds the build current number in an “int”, and the path for creating builds on

And then an editor script that searches for that game object, and checks whats the string for the path to save the build, then creates a new folder on that directory appended by the “int” current number, and then does ++ to the int so that the next build will have a diffrent name

Basically I know how to do everything in this editor script, like interacting with the scene object, creating the folder and progressing the int, what i dont know is the code for actually creating the build

could someone help me with this? You can assume that I already know how to create folders, make editor scripts and trigger them, I just need to know the code to create builds from the editor. Thanks!

Can we assume you also know how to google for using the Unity build pipeline API? :slight_smile:

Because if so you certainly don’t need us to retype it all for you in this little box!!