bevy/examples/reflection
Gino Valente 276815a9a0
examples: Add Type Data reflection example (#13903)
# Objective

Type data is a **super** useful tool to know about when working with
reflection. However, most users don't fully understand how it works or
that you can use it for more than just object-safe traits.

This is unfortunate because it can be surprisingly simple to manually
create your own type data.

We should have an example detailing how type works, how users can define
their own, and how thy can be used.

## Solution

Added a `type_data` example.

This example goes through all the major points about type data:
- Why we need them
- How they can be defined
- The two ways they can be registered
- A list of common/important type data provided by Bevy

I also thought it might be good to go over the `#[reflect_trait]` macro
as part of this example since it has all the other context, including
how to define type data in places where `#[reflect_trait]` won't work.
Because of this, I removed the `trait_reflection` example.

## Testing

You can run the example locally with the following command:

```
cargo run --example type_data
```

---

## Changelog

- Added the `type_data` example
- Removed the `trait_reflection` example
2024-07-15 14:19:50 +00:00
..
custom_attributes.rs bevy_reflect: Custom attributes (#11659) 2024-05-20 19:30:21 +00:00
dynamic_types.rs examples: Add Dynamic Types reflection example (#13220) 2024-05-03 23:34:53 +00:00
function_reflection.rs bevy_reflect: Function reflection (#13152) 2024-07-01 13:49:08 +00:00
generic_reflection.rs
reflection_types.rs
reflection.rs bevy_reflect: Rename UntypedReflectDeserializer to ReflectDeserializer (#12721) 2024-03-26 19:58:29 +00:00
type_data.rs examples: Add Type Data reflection example (#13903) 2024-07-15 14:19:50 +00:00