Open
Description
You are able to store extra data at relationships like this:
#[derive(Component)]
#[relationship(relationship_target = Parent)]
pub struct Child {
#[relationship]
parent: Entity,
pub data: u8, // Relationship data
}
#[derive(Component)]
#[relationship_target(relationship = Child)]
pub struct Parent {
#[relationship]
children: Vec<Entity>,
pub data: u8, // RelationshipTarget data
}
The data is initialized with Default
but can be later modified by the user.
However, it can easily happen to lose the data and have it reset to it's default value. Because of this, the user cannot rely on the value to be preserved unless the relationship remains untouched from then on.
In the following I try to maintain a list of ways where I've seen this can happen. Please help me by pointing out what I forgot, or add to it yourself if you are a maintainer.
RelationshipData
dataRelationshipTarget
data