superunitybuild / buildtool

A powerful automation tool for quickly and easily generating builds with Unity.
MIT License
1.19k stars 121 forks source link

Can i run a prebuild scripts for a configuration without running the player build? #119

Closed MaroLFC closed 1 year ago

MaroLFC commented 1 year ago

My Use case is the following. I create a pre-build script that builds the addressable for my project but sometimes I only need the addressable build and not the player build is there a way to abort the player build and continue to the other build configurations?

robinnorth commented 1 year ago

Hi @MaroLFC, yes, this is possible. If your custom script implements the IPreBuildPerPlatformActionCanConfigureEditor interface, you'll see a 'Configures Editor' checkbox appear on your build action, like so: image

If you check this, the action will then be run when the 'Configure Editor Environment' button is pressed, which runs any pre-build actions with this option enabled, but doesn't run the build itself, or any post-build actions.

Here's an example of a class implementing the interface. There are no member functions to implement, the interface is just used as a means to filter out which pre-build actions should be considered when configuring the Editor:

public class Example: BuildAction, IPreBuildAction, IPreBuildPerPlatformAction, IPostBuildAction, IPostBuildPerPlatformAction, IPreBuildPerPlatformActionCanConfigureEditor
{
}

Hope this helps!

MaroLFC commented 1 year ago

Thank you so much that is a great feature I will use it right away. Can I do the same for the build configurations? like control the Enable and disable of builds through a prebuild action.

Another question I would like to contribute to the project with some of the Build actions I created. How can I do that?

Sorry for bothering you and thanks again

MaroLFC commented 1 year ago

Another question also can i run the configure editor environment button using cli