diff --git a/engine/cocos2d/core/utils/profiler/CCProfiler.js b/engine/cocos2d/core/utils/profiler/CCProfiler.js index f40f273f..53311eb0 100644 --- a/engine/cocos2d/core/utils/profiler/CCProfiler.js +++ b/engine/cocos2d/core/utils/profiler/CCProfiler.js @@ -113,16 +113,19 @@ function generateStats () { }, human() { - const atlases = cc.dynamicAtlasManager.atlases; - const max = cc.dynamicAtlasManager.maxAtlasCount; - const curLess = cc.dynamicAtlasManager.atlasCount; - const oneOfMax = cc.dynamicAtlasManager.textureSize * cc.dynamicAtlasManager.textureSize; - let cur = 0; - for (const key in cc.dynamicAtlasManager.rects) { - const rect = cc.dynamicAtlasManager.rects[key]; - cur += rect.sizes; + if (cc.dynamicAtlasManager && cc.dynamicAtlasManager.enabled) { + const max = cc.dynamicAtlasManager.maxAtlasCount; + const curLess = cc.dynamicAtlasManager.atlasCount; + const oneOfMax = cc.dynamicAtlasManager.textureSize * cc.dynamicAtlasManager.textureSize; + let cur = 0; + for (const key in cc.dynamicAtlasManager.rects) { + const rect = cc.dynamicAtlasManager.rects[key]; + cur += rect.sizes; + } + return `${(cur / oneOfMax).toFixed(2)} / ${curLess} / ${max}`; + } else { + return 'disabled'; } - return `${(cur / oneOfMax).toFixed(2)} / ${curLess} / ${max}`; } }, };