bevy/crates
Dmytro Banin 7a1972ed3d
One-to-One Relationships (#18087)
# Objective

Minimal implementation of directed one-to-one relationships via
implementing `RelationshipSourceCollection` for `Entity`.

Now you can do

```rust
#[derive(Component)]
#[relationship(relationship_target = Below)]
pub struct Above(Entity);

#[derive(Component)]
#[relationship_target(relationship = Above)]
pub struct Below(Entity);
```

## Future Work

It would be nice if the relationships could be fully symmetrical in the
future - in the example above, since `Above` is the source of truth you
can't add `Below` to an entity and have `Above` added automatically.

## Testing

Wrote unit tests for new relationship sources and and verified
adding/removing relationships maintains connection as expected.
2025-03-04 07:57:35 +00:00
..
bevy_a11y Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_animation Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_app Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_asset Make asset watcher work when path contains "../" (#18023) 2025-03-02 18:15:27 +00:00
bevy_audio Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_color Allow bevy_reflect and wgpu-types features in no_std for bevy_color (#18061) 2025-03-01 00:31:35 +00:00
bevy_core_pipeline Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_derive Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_dev_tools Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_diagnostic Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_dylib Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_ecs One-to-One Relationships (#18087) 2025-03-04 07:57:35 +00:00
bevy_encase_derive Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_gilrs Replace some !Send resources with thread_local! (#17730) 2025-03-04 07:48:02 +00:00
bevy_gizmos Incorporate OIT into MeshPipelineKey used by the LineGizmoPipeline (#17946) 2025-02-24 21:31:54 +00:00
bevy_gltf Update itertools requirement from 0.13 to 0.14 (#18128) 2025-03-03 19:36:29 +00:00
bevy_image Update ruzstd requirement from 0.7.0 to 0.8.0 (#18145) 2025-03-03 21:44:51 +00:00
bevy_input Fix incorrect doc about GamepadAxis::RightZ/LeftZ (#18114) 2025-03-02 19:18:01 +00:00
bevy_input_focus Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_internal Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_log Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_macro_utils Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_math Update itertools requirement from 0.13 to 0.14 (#18128) 2025-03-03 19:36:29 +00:00
bevy_mesh Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_mikktspace Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_pbr Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
bevy_picking Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_platform_support Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_ptr moved Debug from derive to impl_ptr in bevy_ptr (#18042) 2025-02-28 02:54:46 +00:00
bevy_reflect Improve bevy_reflect no_std support (#18060) 2025-02-27 06:16:10 +00:00
bevy_remote BRP resource methods (#17423) 2025-02-26 20:29:47 +00:00
bevy_render Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_scene Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_sprite Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_state Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_tasks TaskPool: Prefer task completion over executing new tasks (#18009) 2025-02-26 00:08:36 +00:00
bevy_text Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bevy_time Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_transform Remove ChildOf::get and Deref impl (#18080) 2025-02-27 23:11:03 +00:00
bevy_ui Val::resolve doc comment fix (#18143) 2025-03-03 19:49:52 +00:00
bevy_utils Automatically enable portable-atomic when required (#17570) 2025-02-24 20:52:46 +00:00
bevy_window Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
bevy_winit Replace some !Send resources with thread_local! (#17730) 2025-03-04 07:48:02 +00:00