bevy_lint::lints

Module missing_reflect

Source
Expand description

Checks for components, resources, and events that do not implement Reflect.

§Motivation

Reflection lets programs inspect type information at runtime. It is commonly used by tools to view and edit ECS information while the program is running (usually components and resources). Reflection is opt-in, though, and easy to forget since you need to #[derive(Reflect)] for each type that uses it.

§Known issues

This lint will suggest #[derive(Reflect)] even if it cannot be applied. (E.g. if one of the fields does not implement Reflect.)

§Example

#[derive(Component)]
struct MyComponent;

Use instead:

// Remember to also register this component in the `App` type registry.
#[derive(Component, Reflect)]
struct MyComponent;

Structs§

Statics§