Skip to content

Expose SystemMeta fields #5497

@WinstonHartnett

Description

@WinstonHartnett

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

bevy_ecs' internal implementation of the default SystemParams use SystemMeta to initialize their states. Yet, only the is_send() field accessor is public to end-users and all other fields are pub(crate).

/// The metadata of a [`System`].
#[derive(Clone)]
pub struct SystemMeta {
    pub(crate) name: Cow<'static, str>,
    pub(crate) component_access_set: FilteredAccessSet<ComponentId>,
    pub(crate) archetype_component_access: Access<ArchetypeComponentId>,
    // NOTE: this must be kept private. making a SystemMeta non-send is irreversible to prevent
    // SystemParams from overriding each other
    is_send: bool,
    pub(crate) last_change_tick: u32,
}

Given that it's possible to directly implement SystemParam (and SystemParamFetch) for user-defined types in an unsafe impl, these fields should be exposed to advanced users.

What solution would you like?

Add unsafe mutable and safe immutable accessors for component_access_set and archetype_component_access, and immutable accessors for name and last_change_tick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Adopt-MeThe original PR author has no intent to complete this work. Pick me up!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions