Repository: bevyengine/bevy
File: crates/bevy_gizmos/src/gizmos.rs (Rust)

Code before:
        );
    }

    fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World) {
        GizmosState::<Config, Clear>::apply(&mut state.state, system_meta, world);
    }

    #[inline]
    unsafe fn validate_param(
        state: &mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell,
    ) -> Result<(), SystemParamValidationError> {
        // SAFETY: Delegated to existing `SystemParam` implementation.
        let (_, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                world.change_tick(),
            )
        };
        // This if-block is to accommodate an Option<Gizmos> SystemParam.
        // The user may decide not to initialize a gizmo group, so its config will not exist.
        if f1.into_inner().try_config::<Config>().is_none() {
            Err(SystemParamValidationError::skipped::<Self>(
                format!("Requested config {} does not exist in `GizmoConfigStore`! Did you forget to add it using `app.init_gizmo_group<T>()`?", 
                Config::type_path())))
        } else {
            // SAFETY: Delegated to existing `SystemParam` implementation.
            unsafe {
                GizmosState::<Config, Clear>::validate_param(&mut state.state, system_meta, world)
            }
        }
    }

    #[inline]
    unsafe fn get_param<'w, 's>(
        state: &'s mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell<'w>,
        change_tick: Tick,
    ) -> Self::Item<'w, 's> {
        // SAFETY: Delegated to existing `SystemParam` implementations.
        let (mut f0, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                change_tick,
            )

Review comment (bug):
This should probably be `invalid`, to preserve the existing behavior of plain `Gizmos` parameters failing with a helpful message.  Using `skipped` here will cause systems to silently be skipped if the validation fails.  

`Option<Gizmos>` will still work, since it converts either kind of error to `None`.  And users who do want the skipping behavior can get it using `If<Gizmos>`.  

```suggestion
            Err(SystemParamValidationError::invalid::<Self>(
```

Code after:
        );
    }

    fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World) {
        GizmosState::<Config, Clear>::apply(&mut state.state, system_meta, world);
    }

    #[inline]
    unsafe fn validate_param(
        state: &mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell,
    ) -> Result<(), SystemParamValidationError> {
        // SAFETY: Delegated to existing `SystemParam` implementation.
        unsafe {
            GizmosState::<Config, Clear>::validate_param(&mut state.state, system_meta, world)?;
        }

        // SAFETY: Delegated to existing `SystemParam` implementation.
        let (_, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,
                world.change_tick(),
            )
        };
        // This if-block is to accommodate an Option<Gizmos> SystemParam.
        // The user may decide not to initialize a gizmo group, so its config will not exist.
        if f1.get_config::<Config>().is_none() {
            Err(SystemParamValidationError::invalid::<Self>(
                format!("Requested config {} does not exist in `GizmoConfigStore`! Did you forget to add it using `app.init_gizmo_group<T>()`?", 
                Config::type_path())))
        } else {
            Ok(())
        }
    }

    #[inline]
    unsafe fn get_param<'w, 's>(
        state: &'s mut Self::State,
        system_meta: &SystemMeta,
        world: UnsafeWorldCell<'w>,
        change_tick: Tick,
    ) -> Self::Item<'w, 's> {
        // SAFETY: Delegated to existing `SystemParam` implementations.
        let (mut f0, f1) = unsafe {
            GizmosState::<Config, Clear>::get_param(
                &mut state.state,
                system_meta,
                world,