Game Development Asked by Emad on August 12, 2020
I’ve seen these two special compilation macros in our code base, What’s the difference between #Debug
and #DEVELOPEMENT_BUILD
in Unity? What’s the main purpose of using each?
#if DEBUG
Debug.Log("DEBUG");
#endif
#if DEVELOPMENT_BUILD
Debug.Log("DEVELOPMENT_BUILD");
#endif
In my testing with Unity 2018 (and it is different in Unity 2020 according to the comments), I found DEBUG is true in the editor and during development builds (it is true during the build so the code is compiled into the build). DEBUG is not true during release builds.
DEVELOPMENT_BUILD is never true in the editor except during development builds (so the code is only runs in development builds, never in the editor). I'm not sure whether editor callbacks (surrounded with #if DEVELOPMENT_BUILD
) would run while compiling a development build.
This preprocessor directive is not documented. I reported the omission as a documentation bug, but they may not consider it their responsibility to document .NET conventions.
Answered by piojo on August 12, 2020
From these docs:
You use the DEVELOPMENT_BUILD #define to identify whether your script is running in a player which was built with the “Development Build” option enabled.
On the other hand, DEBUG doesn't exist.
Answered by Bálint on August 12, 2020
1 Asked on November 2, 2021 by glen-pierce
1 Asked on November 2, 2021
1 Asked on November 2, 2021 by vern-rowan
0 Asked on November 2, 2021
0 Asked on November 2, 2021 by anubhav-roy
augmented reality mesh deformation opengl rendering skinning
1 Asked on November 2, 2021 by thrindil
1 Asked on November 2, 2021 by noname123
1 Asked on November 2, 2021
1 Asked on November 2, 2021 by serhii
0 Asked on November 2, 2021 by computer-craft
1 Asked on November 2, 2021 by matheson
0 Asked on November 2, 2021 by saranpat-thanadsornsarn
1 Asked on November 2, 2021 by rocketscienceguy
1 Asked on November 2, 2021 by zechy
1 Asked on March 11, 2021 by steyrix
1 Asked on March 10, 2021
1 Asked on March 5, 2021 by sleepysleeper
Get help from others!
Recent Answers
© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir