Build flag with command line

Hi,
I was wondering if there was a way to put an argument somewhere with a command line that would allow us to change the flag (scripting define symbols).

thanks!

1 Like

It looks like you might be able to write them to a file, which might fit the bill.

1 Like

Did you get any work around until now? Please Share if any.

You have to manually edit the project settings file before running Unity. [your project]/ProjectSettings/ProjectSettings.asset it contains the scriptingDefineSymbols.

It might look like this

  scriptingDefineSymbols: {}

Or this

  scriptingDefineSymbols:
    1: YOUR_SYMBOL;MY_SYMBOL
    13:

Or it may not exist at all in which case you will need to add it. The numbers are associated with the build target (I don’t know what numbers are for which target, you can figure it out by changing the symbols in editor and see how the file changes).

Keep in mind that this is undocumented, so it may change, but it will hold true as long as you stay on the same Unity version.

[Edit] Also, this is true as of 2018.4.36f1, I haven’t checked to see if it’s changed in 2020.

[Edit2] Looks like the numbers are associated with the UnityEditor.BuildTargetGroup enum.