this post was submitted on 05 May 2025
6 points (100.0% liked)
Bevy
362 readers
1 users here now
A community for discussion around the bevy game engine! https://bevyengine.org/
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
It's a feature called required components. Basically, you can use #require(components list here) attribute to say that when a component is inserted, also insert required components. I don't know if there's a documentation for it, or specifically what component requires what, personally when I'm looking for required components I'm looking at component's source and they'll be listed there (Sprite, for example https://docs.rs/bevy_sprite/0.16.0/src/bevy_sprite/sprite.rs.html#20)
Note that required components work recursively: when component requires a component that has it's own requirements, they'll also be inserted
The required components are documented in the component impl block. Scroll down in docs.rs until you find
impl Component
and they'll show up there.Apparently there were issues getting required components to show up at the top of the page (from my understanding anyway), so for now they live there.
Ah, that's it! Thank you so much.
I was digging through the systems functions, totally forgot to just look at the attributes. Not that experienced with rust yet :P