Checking build type at runtime

Is it possible to check build type (for example, if it is debug build or not) via Typescript? For example, I want to turn on cheat menu for testing, by adding or removing cheat button from scene. Now I have to manually comment related code before building release version, and I’m looking for a way to automate this process.

You can use DEBUG.

But how exactly? I couldn’t find any documentation about this constant

I found there’s globalThis.CC_DEBUG

I’m not sure if it’s safe to use, because it’s not documented, but I think it’ll work for now.

https://docs.cocos.com/creator/manual/en/scripting/modules/engine.html#build-time-constants

Thanks a lot!