Use Time resource instead of Extracting Time (#7316)

# Objective

- "Fixes #7308".

## Solution

- Use the `Time` `Resource` instead of `Extract<Res<Time>>`
This commit is contained in:
targrub 2023-01-21 17:55:39 +00:00
parent cb4e8c832c
commit ff5e4fd1ec

View file

@ -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 {