Cocos Creator 디버그, 실행 환경 알아내기
코코스 크리에이터에서 디버그 모드인지 릴리즈 모드인지 등의 환경을 확인해보기 위해 리서치 해봤습니다. api 문서에보면 GLOBAL MACROS라고 전역 메크로 로 지원해주고 있네요. 일단 마치 유니티의 Debug.isDebugBuild 같은 기능을 찾고 있었는데, 간단히 CC_DEBUG를 통해 에디터 || 프리뷰 || 디버그모드 인지 확인이 가능합니다. 그외에도 api 문서에 있는 것 처럼 아래의 것들을 지원해주고 있네요. CC_EDITOR Boolean Running in the editor. CC_PREVIEW Boolean Preview in browser or simulator. CC_DEV Boolean Running in the editor or preview. CC_DEBUG Boolean Running in the editor or preview, or build in debug mode. CC_BUILD Boolean Running in published project. CC_JSB Boolean Running in native platform (mobile app, desktop app, or simulator). CC_TEST Boolean Running in the engine's unit test. CC_RUNTIME Boolean Running in runtime environments.