- Home /
How do I define ScriptDefines from either the command line or with executeScript
How do I add ScriptDefines for
#ifdef NAMEOFDEFINE
<code A>
#else
<code B>
#endif
when building from the command line or by using ExecuteScript? I need this for my CI setup.
Answer by Bodhid · Sep 13, 2017 at 02:17 PM
Scripting define symbols can be set in playersettings. In a build script you could use this: https://docs.unity3d.com/ScriptReference/PlayerSettings.SetScriptingDefineSymbolsForGroup.html
Is this what you mean?
Yes and I am using this already. I just wondered if there is any better way to do this. I expected something like a -define argument for building from the command line, because of the way defines work you can run into race conditions when using it this way (you essentially have to set it, wait until the editor closes such that unity does not run into lock problems, run the build)
Your answer
![](https://koobas.hobune.stream/wayback/20220612134753im_/https://answers.unity.com/themes/thub/images/avi.jpg)