Bevy version and features
What you did
- Create a 3d camera entity with
RenderTarget::None
- print value of
camera.computed.target_info.
- Update the
RenderTarget::None { size }.
Or run code below:
use bevy::{camera::RenderTarget, prelude::*};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.add_systems(Update, update)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn((
Camera3d::default(),
RenderTarget::None {
size: UVec2::splat(512),
},
));
}
fn update(query: Single<(&Camera, &mut RenderTarget)>, time: Res<Time>) {
let (camera, mut target) = query.into_inner();
bevy::log::info!("{:?}, {:?}", camera.computed.target_info, *target);
let size = ((time.elapsed_secs().sin() + 2.0) * 100.0) as u32;
*target = RenderTarget::None {
size: UVec2::splat(size),
};
}
What went wrong
the console outputs:
Some(RenderTargetInfo { physical_size: UVec2(512, 512), scale_factor: 1.0 }), None { size: UVec2(512, 512) }
Some(RenderTargetInfo { physical_size: UVec2(200, 200), scale_factor: 1.0 }), None { size: UVec2(200, 200) }
Some(RenderTargetInfo { physical_size: UVec2(200, 200), scale_factor: 1.0 }), None { size: UVec2(210, 210) }
Some(RenderTargetInfo { physical_size: UVec2(200, 200), scale_factor: 1.0 }), None { size: UVec2(234, 234) }
......
- what were you expecting?
physical_size should be same as RenderTarget::None { size }
- what actually happened?
after the second update tick, physical_size remains unchanged
Additional information
the is_changed() function of NormalizedRenderTarget always return false when it is NormalizedRenderTarget::None, making the camera_system failed to update the corresponding value.
I discovered this bug while examining the render_depth_to_texture example. When I modified the size value in RenderTarget::None { size }, the size of the corresponding ViewDepthTexture did not change accordingly.
Bevy version and features
What you did
RenderTarget::Nonecamera.computed.target_info.RenderTarget::None { size }.Or run code below:
What went wrong
the console outputs:
physical_sizeshould be same asRenderTarget::None { size }after the second update tick,
physical_sizeremains unchangedAdditional information
the
is_changed()function ofNormalizedRenderTargetalways returnfalsewhen it isNormalizedRenderTarget::None, making thecamera_systemfailed to update the corresponding value.I discovered this bug while examining the render_depth_to_texture example. When I modified the size value in RenderTarget::None { size }, the size of the corresponding ViewDepthTexture did not change accordingly.