diff --git a/DebugInfos.js b/DebugInfos.js index 941771490e..a85a68d007 100644 --- a/DebugInfos.js +++ b/DebugInfos.js @@ -580,7 +580,7 @@ if (CC_DEV) { //Physics: 8200 "8200": "Please set node\'s active instead of rigidbody\'s enabled.", //cc.RigidBody.enabled //Camera: 8300 - "8300": "Should only one camera be enabled, please check your project.", //cc.Camera.enabled + "8300": "Should only one camera exists, please check your project.", //cc.Camera.enabled }; cc._LogInfos = logs; } diff --git a/cocos2d/core/camera/CCCamera.js b/cocos2d/core/camera/CCCamera.js index fa4a6f1dc8..99aa572702 100644 --- a/cocos2d/core/camera/CCCamera.js +++ b/cocos2d/core/camera/CCCamera.js @@ -73,7 +73,7 @@ let Camera = cc.Class({ onEnable: function () { if (Camera.main) { - cc.warnID('8300'); + cc.errorID(8300); return; } @@ -86,6 +86,10 @@ let Camera = cc.Class({ }, onDisable: function () { + if (Camera.main !== this) { + return; + } + Camera.main = null; let targets = this._targets;