Programmatically start a build defining conditional compilation symbols

Hello,
Is it possible to write an Editor script which starts a build after defining conditional compilation symbols (ie. those identifiers used in pre-processor directives such as #if) for that build?
I have a client-server architecture, and in my Unity project I have some scripts which should be compiled only for server, some only for client, and some for both.
I was thinking about to use pre-processor directives, and to create two separate Editor scripts, to build the server and the client respectively, but I don’t know how to do.
I found the BuildPipeline class, but I haven’t found a way to do it.
Thank you in advance for your help.

I use the unity cloud for that, we build a few different types of build per batch there.

1 Like

Thank you for your answer! I didn’t notice you could do it with Cloud Build. :slight_smile:
Do you think it’s also possible to change player settings, such as disabling XR (Vuforia) for the server build while keeping it for the client build?
Thank you again! :slight_smile:

Hard to say actually, looking at it I can’t really find that specific option.
I mostly use the advanced->custom defines for most things as our code is define-based.

1 Like