Difference between #DEBUG and #DEVELOPMENT_BUILD in Unity?

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?



2 Answers

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

Add your own answers!

Related Questions

How can I make particles move like a square in Unity?

1  Asked on December 21, 2021 by magikarpsama


How can I make the text flash?

1  Asked on December 20, 2021


Transform.Rotate is jumping around

1  Asked on December 18, 2021


World space coords for 2d images

1  Asked on December 15, 2021 by user3134909


Save-security with MD5 hash

3  Asked on December 13, 2021 by abdulla


Rigidbody player controller on moving platforms

1  Asked on December 13, 2021 by gorgo-3


Polygon filling algorithm

0  Asked on December 13, 2021


Leaderboard not working in Unity

1  Asked on December 11, 2021 by single-arrow-games


2D Grid-based Pathfinding with Elevation

1  Asked on December 11, 2021 by oyed


Placing Zones in Cities Skylines

1  Asked on December 8, 2021 by fence_rider


Frame-rate drops when drawing 2D map tiles

1  Asked on December 6, 2021 by theco


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP