Global conditional flags?

I have an amount of [Conditional] based functions, which need to be called from other scripts through references. I noticed that in my case I need to grant a #define DEBUG_BUILD, in every script that relies on these set of functions and then it works.

The questions is, can I, for the time being set a global flag “DEBUG_BUILD” that would apply everywhere. I could technically delete the [Conditional]s but they’re everywhere and for a couple of good reasons.

So, is it possible to set one flag that will apply across the project?

Hey again, yes it is.

In Unity, you can add the symbols in the player settings, they’re listed as Scripting Define Symbols.

When only working on a pure VS project, e.g. a library that you want to compile differently for various platforms / configurations, you’d add the symbols in the project’s properties (here they’re listed as Conditional Compilation Symbols).

1 Like

Yep. I guess you’re my Good Spirit now :smile:

For people wondering Edit > Project Settings > Project > (Tab) Other Settings > (Lable) Configuration > Scripting Define Symbols. Third from bottom, sixth from top.