diff --git a/native/cocos/renderer/pipeline/forward/UIPhase.cpp b/native/cocos/renderer/pipeline/forward/UIPhase.cpp index 54f9f4d17c..e7c43fbce7 100644 --- a/native/cocos/renderer/pipeline/forward/UIPhase.cpp +++ b/native/cocos/renderer/pipeline/forward/UIPhase.cpp @@ -39,20 +39,13 @@ void UIPhase::render(Camera *camera, gfx::RenderPass *renderPass){ auto cmdBuff = pipeline->getCommandBuffers()[0]; auto batches = camera->getScene()->getUIBatches(); - const auto vis = camera->visibility & static_cast(LayerList::UI_2D); const int batchCount = batches[0]; // Notice: The batches[0] is batchCount for (int i = 1; i <= batchCount; ++i) { const auto batch = GET_UI_BATCH(batches[i]); bool visible = false; - if (vis) { - if (camera->visibility == batch->visFlags) { - visible = true; - } - } else { - if (camera->visibility & batch->visFlags) { - visible = true; - } + if (camera->visibility & batch->visFlags) { + visible = true; } if (!visible) continue;