diff --git a/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs b/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs index eef183d9850bb..495038d898e90 100644 --- a/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs +++ b/crates/bevy_render/src/render_graph/nodes/render_resources_node.rs @@ -470,11 +470,12 @@ fn render_resources_node_system( } for (entity, uniforms, draw, mut render_pipelines) in queries.q0_mut().iter_mut() { + uniform_buffer_arrays.prepare_uniform_buffers(entity, uniforms); + if !draw.is_visible { continue; } - uniform_buffer_arrays.prepare_uniform_buffers(entity, uniforms); if !setup_uniform_texture_resources::( &uniforms, render_resource_context, @@ -498,13 +499,9 @@ fn render_resources_node_system( &mut |mut staging_buffer, _render_resource_context| { // if the buffer array was resized, write all entities to the new buffer, otherwise only write changes if resized { - for (entity, uniforms, draw, mut render_pipelines) in + for (entity, uniforms, _draw, mut render_pipelines) in queries.q1_mut().iter_mut() { - if !draw.is_visible { - continue; - } - state.uniform_buffer_arrays.write_uniform_buffers( entity, &uniforms,