-
-
Couldn't load subscription status.
- Fork 4.2k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!D-UnsafeTouches with unsafe code in some wayTouches with unsafe code in some wayS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!X-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makersHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
Milestone
Description
Bevy version and features
Bevy 0.17.2
What you did
commands.spawn(Player, related!(Equipment[items::fire_staff(&sprites, &sprite_layouts)]));
...
pub fn on_item_equipped(
trigger: On<Add, EquipmentOf>,
mut commands: Commands,
mut item_query: Query<(
Option<&Equippable>,
Option<&EquipmentOf>,
Option<&mut Visibility>,
)>,
) {
let equipped_entity = trigger.event().entity;
info!("{:?}", item_query.get_mut(equipped_entity));
// prints None, Some, None
}What went wrong
In Bevy 0.17, relationships using the related! spawn API are inserted first (separately from the rest of the bundle). This prevents developers from using lifecycle events on the relationship that access the contents of the bundle. This is a major functionality loss from Bevy 0.16, where this worked.
I believe this was introduced in #20772, which split this out in the interest of solving a stack overflow issue. This particular behavior was not really the cause of the stack overflow / I believe we can restore it in the context of the new system.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!D-UnsafeTouches with unsafe code in some wayTouches with unsafe code in some wayS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!X-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makersHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers