How to detect game running from IDE?

How to detect game running from IDE?

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.

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

if (CC_EDITOR) {
// You are on editor

// 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.