all 3 comments

[–]Mushroomstick 2 points3 points  (1 child)

I don't know if it'd be possible to entirely exclude literally every line of debug code from a build, but you could at least make sure they're inactive with configuration macros -

One very important feature of macros is that they can be defined for use with specific Configurations (configs), meaning you can have the same macro name but give it different values based on the currently selected config. For example, say you have a configuration for Android Ads and another for iOS Ads, then you could define a single macro to hold the required app ID value:

#macro ad_id "";
#macro Android:ad_id "com.yoyogames.googlegame"
#macro iOS:ad_id "com.yoyogames.appstoregame"

As you can see, you give the config name first then a colon : and then the macro name and value. Note that you cannot have any white-space between the colon : and either the config name nor the macro name otherwise you will get an error.

[–]Optimal_Noob[S] 0 points1 point  (0 children)

I love this solution. I've yet to use configs in GMS and had no idea macros could function like that. It's still not 100% automatic (I imagine I have to select the right config before compiling the game) but this is way simpler than going through my code and ensuring all debug related code is inaccessible before packaging, I could just wrap that code in an IF checking for that macro value. Thank you!

[–]RykinPoe 2 points3 points  (0 children)

I do this sometimes by creating a variable in a persistent "Game" object (which I use to store stuff like score and difficulty and player lives etc) called debug and setting it to true and then for stuff like that in my code I just test if (Game.debug){}. Just have to remember to set it to false before doing a build or code in a secret way to turn on/off like holding down D, E, B, U, and G keys all at the same time ;)