unity-define-inspector icon indicating copy to clipboard operation
unity-define-inspector copied to clipboard

What are script defines?

Open MostHated opened this issue 7 years ago • 2 comments

Hey there, I had a quick question about this. I have not really use defines before, when you add one like in your example gif it has to reference something within the code, doesn't it? If I am guessing correctly, the asset in itself won't actually do anything, but it allows you to quickly toggle on and off things if you already have your project setup to use them?

Thanks!

MostHated avatar May 02 '18 00:05 MostHated

See this guide for more info on define symbols in Unity: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

I recommend using them as minimal as possible since every time you add one you now need to test your build with and without the define. However they do come in handy.

Under the hood, unity is doing this: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-define

haydenjameslee avatar May 02 '18 01:05 haydenjameslee

Ah ok, I got ya. Definitely looks useful in specific situations. I appreciate it, thanks.

MostHated avatar May 02 '18 01:05 MostHated