bevy/crates
Alice Cecile b34833f00c
Add an example teaching users about custom relationships (#17443)
# Objective

After #17398, Bevy now has relations! We don't teach users how to make /
work with these in the examples yet though, but we definitely should.

## Solution

- Add a simple abstract example that goes over defining, spawning,
traversing and removing a custom relations.
- ~~Add `Relationship` and `RelationshipTarget` to the prelude: the
trait methods are really helpful here.~~
- this causes subtle ambiguities with method names and weird compiler
errors. Not doing it here!
- Clean up related documentation that I referenced when writing this
example.

## Testing

`cargo run --example relationships`

## Notes to reviewers

1. Yes, I know that the cycle detection code could be more efficient. I
decided to reduce the caching to avoid distracting from the broader
point of "here's how you traverse relationships".
2. Instead of using an `App`, I've decide to use
`World::run_system_once` + system functions defined inside of `main` to
do something closer to literate programming.

---------

Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
Co-authored-by: Kristoffer Søholm <k.soeholm@gmail.com>
2025-01-20 23:17:38 +00:00
..
bevy_a11y Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_animation Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_app Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_asset Switch bevy_asset to core::prelude (#17442) 2025-01-20 04:14:48 +00:00
bevy_audio Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_color Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_core_pipeline Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
bevy_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dev_tools Rename TargetCamera to UiTargetCamera (#17403) 2025-01-19 19:56:57 +00:00
bevy_diagnostic Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_dylib Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_ecs Add an example teaching users about custom relationships (#17443) 2025-01-20 23:17:38 +00:00
bevy_encase_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gilrs Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
bevy_gizmos Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
bevy_gltf Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
bevy_image Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_input Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_input_focus Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_internal Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_log Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_macro_utils Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_math Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
bevy_mesh Expose a few primitive builders, which seemed to be missed? (#17454) 2025-01-20 21:29:38 +00:00
bevy_mikktspace Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_pbr Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
bevy_picking Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_platform_support Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_ptr Update safety docs for Ptr::assert_unique (#17394) 2025-01-16 03:25:19 +00:00
bevy_reflect Include ReflectFromReflect in all dynamic data types. (#17453) 2025-01-20 22:08:24 +00:00
bevy_remote Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_render Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_scene Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_sprite Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_state Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_tasks Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_text Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_time Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_transform Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_ui Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_utils Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_window Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_winit Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00