Skip to content

Allow to describe the behavior when VisibilityFilter is missing on the client entity #626

@Shatur

Description

@Shatur

Right when the filter component is missing on the client, entities with this component will be hidden. But it's not always desirable. Users may want to express the reverse behavior - make entities visible, unless the client has the filter component.

This requires 2 simple changes to the API:

  1. Swap order in is_visible. Make entity filter self and pass client filter as an argument.
  2. Wrap second argument into Option.

It's also possible to do it without introducing breaking changes by introducing an associated constant like this:

    /// Whether [`Self::Scope`] is visible when this filter component
    /// is missing on the client, but present on the entity.
    const VISIBLE_WHEN_MISSING: bool = false;

But I think Option is more idiomatic. I plan to implement it after the release for Bevy 0.18.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions