Repository: bevyengine/bevy
File: examples/testbed/ui.rs (Rust)

Code before:
            "radialgradient" => Ok(Scene::RadialGradient),
            "transformations" => Ok(Scene::Transformations),
            #[cfg(feature = "bevy_ui_debug")]
            "debugoutlines" => Ok(Scene::DebugOutlines),
            "viewportcoords" => Ok(Scene::ViewportCoords),
            _ => Err(format!(
                "Scene '{}' doesn't exist. Available scenes:\n\t{}",
                s,
                [
                    "Image",
                    "Text",
                    "Grid",
                    "Borders",
                    "BoxShadow",
                    "TextWrap",
                    "Overflow",
                    "Slice",
                    "LayoutRounding",
                    "LinearGradient",
                    "RadialGradient",
                    "Transformations",
                    #[cfg(feature = "bevy_ui_debug")]
                    "DebugOutlines",
                    "ViewportCoords",
                ]
                .join("\n\t")
            )),
        }
    }
}

impl Next for Scene {
    fn next(&self) -> Self {
        match self {
            Scene::Image => Scene::Text,
            Scene::Text => Scene::Grid,
            Scene::Grid => Scene::Borders,
            Scene::Borders => Scene::BoxShadow,
            Scene::BoxShadow => Scene::TextWrap,
            Scene::TextWrap => Scene::Overflow,
            Scene::Overflow => Scene::Slice,
            Scene::Slice => Scene::LayoutRounding,
            Scene::LayoutRounding => Scene::LinearGradient,
            Scene::LinearGradient => Scene::RadialGradient,
            #[cfg(feature = "bevy_ui_debug")]
            Scene::RadialGradient => Scene::DebugOutlines,
            #[cfg(feature = "bevy_ui_debug")]
            Scene::DebugOutlines => Scene::Transformations,
            #[cfg(not(feature = "bevy_ui_debug"))]
            Scene::RadialGradient => Scene::Transformations,
            Scene::Transformations => Scene::ViewportCoords,

Review comment (bug):
It might be nice to add a reminder if `#[cfg(not(feature = “bevy_ui_debug”))]` saying something like “To be able to view the DebugOutlines scene, enable the bevy_ui_debug feature via `--features=bevy_ui_debug`”

Code after:
impl Next for Scene {
    fn next(&self) -> Self {
        match self {
            Scene::Image => Scene::Text,
            Scene::Text => Scene::Grid,
            Scene::Grid => Scene::Borders,
            Scene::Borders => Scene::BoxShadow,
            Scene::BoxShadow => Scene::TextWrap,
            Scene::TextWrap => Scene::Overflow,
            Scene::Overflow => Scene::Slice,
            Scene::Slice => Scene::LayoutRounding,
            Scene::LayoutRounding => Scene::LinearGradient,
            Scene::LinearGradient => Scene::RadialGradient,
            #[cfg(feature = "bevy_ui_debug")]
            Scene::RadialGradient => Scene::DebugOutlines,
            #[cfg(feature = "bevy_ui_debug")]
            Scene::DebugOutlines => Scene::Transformations,
            #[cfg(not(feature = "bevy_ui_debug"))]
            Scene::RadialGradient => Scene::Transformations,
            Scene::Transformations => Scene::ViewportCoords,
            Scene::ViewportCoords => Scene::Image,
        }
    }
}

fn switch_scene(
    keyboard: Res<ButtonInput<KeyCode>>,
    scene: Res<State<Scene>>,
    mut next_scene: ResMut<NextState<Scene>>,
) {
    if keyboard.just_pressed(KeyCode::Space) {
        info!("Switching scene");
        next_scene.set(scene.get().next());
    }
}

mod image {
    use bevy::prelude::*;

    pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
        commands.spawn((Camera2d, DespawnOnExit(super::Scene::Image)));
        commands.spawn((
            ImageNode::new(asset_server.load("branding/bevy_logo_dark.png")),
            DespawnOnExit(super::Scene::Image),
        ));
    }
}

mod text {
    use bevy::{color::palettes::css::*, prelude::*};