-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Expose SystemMeta fields #5497
Copy link
Copy link
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite 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!The original PR author has no intent to complete this work. Pick me up!
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite 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!The original PR author has no intent to complete this work. Pick me up!