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