From a590adca632b5ecf0430b56df6a2d6591ee648d3 Mon Sep 17 00:00:00 2001 From: Martin Dickopp Date: Sun, 29 Dec 2024 23:45:17 +0100 Subject: [PATCH] Fix confusing comment in pbr example (#16996) After a recent fix for a panic in the pbr example (#16976), the code contains the following comment: ```rust // This system relies on system parameters that are not available at start // Ignore parameter failures so that it will run when possible .add_systems(Update, environment_map_load_finish.never_param_warn()) ``` However, this explanation is incorrect. `EnvironmentMapLabel` is available at start. The real issue is that it is no longer available once it has been removed by `environment_map_load_finish`. - Remove confusing/incorrect comment and `never_param_warn()`. - Make `Single>` optional in `environment_map_load_finish`, and check that the entity has not yet been despawned. Since it is expected that an entity is no longer there once it has been despawned, it seems better to me to handle this case in `environment_map_load_finish`. Ran `cargo run --example pbr`. --- examples/3d/pbr.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/3d/pbr.rs b/examples/3d/pbr.rs index 49e1fca5e4..46f82bcc65 100644 --- a/examples/3d/pbr.rs +++ b/examples/3d/pbr.rs @@ -7,9 +7,7 @@ fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) - // This system relies on system parameters that are not available at start - // Ignore parameter failures so that it will run when possible - .add_systems(Update, environment_map_load_finish.never_param_warn()) + .add_systems(Update, environment_map_load_finish) .run(); }