mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Use Time
resource
instead of Extract
ing Time
(#7316)
# Objective - "Fixes #7308". ## Solution - Use the `Time` `Resource` instead of `Extract<Res<Time>>`
This commit is contained in:
parent
cb4e8c832c
commit
ff5e4fd1ec
1 changed files with 3 additions and 12 deletions
|
@ -8,7 +8,7 @@ use bevy::{
|
|||
math::{DVec2, DVec3},
|
||||
pbr::{ExtractedPointLight, GlobalLightMeta},
|
||||
prelude::*,
|
||||
render::{camera::ScalingMode, Extract, RenderApp, RenderStage},
|
||||
render::{camera::ScalingMode, RenderApp, RenderStage},
|
||||
window::{PresentMode, WindowPlugin},
|
||||
};
|
||||
use rand::{thread_rng, Rng};
|
||||
|
@ -156,15 +156,13 @@ impl Plugin for LogVisibleLights {
|
|||
Err(_) => return,
|
||||
};
|
||||
|
||||
render_app
|
||||
.add_system_to_stage(RenderStage::Extract, extract_time)
|
||||
.add_system_to_stage(RenderStage::Prepare, print_visible_light_count);
|
||||
render_app.add_system_to_stage(RenderStage::Prepare, print_visible_light_count);
|
||||
}
|
||||
}
|
||||
|
||||
// System for printing the number of meshes on every tick of the timer
|
||||
fn print_visible_light_count(
|
||||
time: Res<ExtractedTime>,
|
||||
time: Res<Time>,
|
||||
mut timer: Local<PrintingTimer>,
|
||||
visible: Query<&ExtractedPointLight>,
|
||||
global_light_meta: Res<GlobalLightMeta>,
|
||||
|
@ -180,13 +178,6 @@ fn print_visible_light_count(
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Resource, Deref, DerefMut)]
|
||||
pub struct ExtractedTime(Time);
|
||||
|
||||
fn extract_time(mut commands: Commands, time: Extract<Res<Time>>) {
|
||||
commands.insert_resource(ExtractedTime(time.clone()));
|
||||
}
|
||||
|
||||
struct PrintingTimer(Timer);
|
||||
|
||||
impl Default for PrintingTimer {
|
||||
|
|
Loading…
Reference in a new issue