Skip to content

Optionally keep around an empty Children component #19682

Open
@gwafotapa

Description

@gwafotapa

What problem does this solve or what need does it fill?

I have a game involving cards which can be in different zones (hand, deck, discard, ...). Each zone is implemented as an entity with a Children component holding its cards. I'm using the Children component instead of my own component because I want the transform propagation.

When the last card of a zone is removed, the Children component is removed from the zone. Because of that, I always have to query for the zones with Option<Children>. More annoying, I have systems reacting to Changed<Children> for the zones (e.g. to update graphics whenever a card entered or left the zone). I need to handle separately the special case where the last children are removed because there will be no change detected since the Children component is not there anymore.

What solution would you like?

I would like the Children component not to be removed when its underlying vector is empty for these entities. The current behavior is what you usually want so I would like that new behavior to be opt-in. I haven't really thought how to implement it. I'm curious if others have run into that issue.

What alternative(s) have you considered?

As explained above, I'm doing without so this is not really a limitation but it would be nice to have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleS-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions