mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 06:00:20 +00:00
Add Archetype::component_count (#12119)
Add Archetype::component_count utility method # Objective I wanted a method to count components on an archetype without iterating over them. ## Solution Added `Archetype::component_count` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
parent
c4caebb528
commit
e0e9794c9e
1 changed files with 6 additions and 0 deletions
|
@ -404,6 +404,12 @@ impl Archetype {
|
||||||
self.components.indices()
|
self.components.indices()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the total number of components in the archetype
|
||||||
|
#[inline]
|
||||||
|
pub fn component_count(&self) -> usize {
|
||||||
|
self.components.len()
|
||||||
|
}
|
||||||
|
|
||||||
/// Fetches a immutable reference to the archetype's [`Edges`], a cache of
|
/// Fetches a immutable reference to the archetype's [`Edges`], a cache of
|
||||||
/// archetypal relationships.
|
/// archetypal relationships.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in a new issue