diff --git a/cocos/2d/CCProtectedNode.cpp b/cocos/2d/CCProtectedNode.cpp index 3a8259b48d..b5f078a394 100644 --- a/cocos/2d/CCProtectedNode.cpp +++ b/cocos/2d/CCProtectedNode.cpp @@ -271,7 +271,7 @@ void ProtectedNode::reorderProtectedChild(cocos2d::Node *child, int localZOrder) void ProtectedNode::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags) { // quick return if not visible. children won't be drawn. - if (!_visible) + if (!_visible || !isVisitableByVisitingCamera()) { return; } diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 4ccdba0db0..b682b3d7a7 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -236,7 +236,7 @@ void Widget::onExit() void Widget::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) { - if (_visible) + if (_visible || !isVisitableByVisitingCamera()) { adaptRenderers(); ProtectedNode::visit(renderer, parentTransform, parentFlags); diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index b49257212c..c9d2f19669 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -579,7 +579,7 @@ void ScrollView::onAfterDraw() void ScrollView::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) { // quick return if not visible - if (!isVisible()) + if (!isVisible() || !isVisitableByVisitingCamera()) { return; }