How to detect game running from IDE?

How to detect game running from IDE?
0

I want to test my game with some dummy data without making a build.
To do this, I want to find out whether Cocos Creator game is started form the IDE or it running after making a build.

Is there a way to detect this?

Ccassert is the keyword I think.

Can you please explain it further. I can’t find any keyword “Ccassert” in documentation.

Can anyone provide some assistance for this?

I found these macros that allow me to do it.
https://docs.cocos2d-x.org/creator/api/en/modules/GLOBAL-MACROS.html

You can detect if you on IDE or Preview with the following:

if (CC_EDITOR) {
// You are on editor
}

if (CC_PREVIEW) {
// You are now under preview mode. Which means you pressed play and the web broser hasa shown up/
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.