Detect DebugMode value from code (JS) at runtime

Is it possible to know the DebugMode flag at runtime in Cocos Creator 1.9.3 Facebook Instant Games build? (Without hacking main.js)

I’ve googled my brains out and found absolutely nothing. The DebugMode enum documentation very “helpfully” repeats the exact enum names, and that’s it.

That value has to be buried in the API somewhere, right??

It seems I’ve barked up the wrong tree. The DebugMode value appears to be for logging flags, not for the build.

Is there anything that allows us to know the build type?

Ha! This is gross, but appears to work in 1.9.3. Could probably disappear or be moved in any future release.

let isDebug = cc.game.config[cc.game.CONFIG_KEY.debugMode] == 1;

Hi @jasontosh. I use CC_DEBUG.
You can read about all macros here: https://docs.cocos2d-x.org/creator/api/en/modules/GLOBAL-MACROS.html

1 Like