diff --git a/Cargo.toml b/Cargo.toml index 6bc73fbd2c..46b8238596 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4426,6 +4426,7 @@ wasm = true name = "clustered_decals" path = "examples/3d/clustered_decals.rs" doc-scrape-examples = true +required-features = ["pbr_clustered_decals"] [package.metadata.example.clustered_decals] name = "Clustered Decals" @@ -4437,6 +4438,7 @@ wasm = false name = "light_textures" path = "examples/3d/light_textures.rs" doc-scrape-examples = true +required-features = ["pbr_light_textures"] [package.metadata.example.light_textures] name = "Light Textures" diff --git a/examples/3d/clustered_decals.rs b/examples/3d/clustered_decals.rs index f8592d28c0..60a445b483 100644 --- a/examples/3d/clustered_decals.rs +++ b/examples/3d/clustered_decals.rs @@ -2,7 +2,6 @@ use std::f32::consts::{FRAC_PI_3, PI}; use std::fmt::{self, Formatter}; -use std::process; use bevy::{ color::palettes::css::{LIME, ORANGE_RED, SILVER}, @@ -163,16 +162,10 @@ fn setup( mut meshes: ResMut>, mut materials: ResMut>>, ) { - // Error out if the clustered decals feature isn't enabled - if !cfg!(feature = "pbr_clustered_decals") { - eprintln!("Bevy was compiled without clustered decal support. Run with `--features=pbr_clustered_decals` to enable."); - process::exit(1); - } - // Error out if clustered decals aren't supported on the current platform. if !decal::clustered::clustered_decals_are_usable(&render_device, &render_adapter) { - eprintln!("Clustered decals aren't usable on this platform."); - process::exit(1); + error!("Clustered decals aren't usable on this platform."); + commands.send_event(AppExit::error()); } spawn_cube(&mut commands, &mut meshes, &mut materials); diff --git a/examples/3d/light_textures.rs b/examples/3d/light_textures.rs index be221101b6..94ddd159f2 100644 --- a/examples/3d/light_textures.rs +++ b/examples/3d/light_textures.rs @@ -2,7 +2,6 @@ use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, FRAC_PI_4, PI}; use std::fmt::{self, Formatter}; -use std::process; use bevy::{ color::palettes::css::{SILVER, YELLOW}, @@ -155,16 +154,10 @@ fn setup( mut meshes: ResMut>, mut materials: ResMut>, ) { - // Error out if the light textures feature isn't enabled - if !cfg!(feature = "pbr_light_textures") { - eprintln!("Bevy was compiled without light texture support. Run with `--features=pbr_light_textures` to enable."); - process::exit(1); - } - // Error out if clustered decals (and so light textures) aren't supported on the current platform. if !decal::clustered::clustered_decals_are_usable(&render_device, &render_adapter) { - eprintln!("Light textures aren't usable on this platform."); - process::exit(1); + error!("Light textures aren't usable on this platform."); + commands.send_event(AppExit::error()); } spawn_cubes(&mut commands, &mut meshes, &mut materials);