Pre-Processor Setup Debugs

Hi Guys,

I want to create an automatic debug setting for my game. So when I build the game, I can flick a switch in my game’s settings to change whether a load of code in the game is activated in the game or not; A ‘debugging’ section in all of my scripts, that shows data on a debug UI about the game’s behind the scenes data. It’ll recognise whether it’s a debug version of the game or not, and will show the UI and call all of it’s data to be shown upon different in game events.

I was thinking about setting some precompiler #define which acknowledges whether it’s a Debug version, or a proper version… And from that passes code to the build to be called.

Has anyone done this, or is there a standard way to set this up?

Thanks!

You can add custom defines in the build settings. I use them from time to time when building to different webplayer platforms, like Facebook and Kongregate.

There is also an official development build. Not sure if you can check this with preprocesser directives.

You can use Debug.isDebugBuild to check at runtime or set defines in the build settings, they can also be set through a script EditorUserBuildSettings.activeScriptCompilationDefines.

2 Likes

Awesomesauce :slight_smile: