diff --git a/crates/bevy_image/src/texture_atlas.rs b/crates/bevy_image/src/texture_atlas.rs index b5b68b0c41..4caeed8c07 100644 --- a/crates/bevy_image/src/texture_atlas.rs +++ b/crates/bevy_image/src/texture_atlas.rs @@ -222,6 +222,18 @@ impl TextureAtlas { let atlas = texture_atlases.get(&self.layout)?; atlas.textures.get(self.index).copied() } + + /// Returns this [`TextureAtlas`] with the specified index. + pub fn with_index(mut self, index: usize) -> Self { + self.index = index; + self + } + + /// Returns this [`TextureAtlas`] with the specified [`TextureAtlasLayout`] handle. + pub fn with_layout(mut self, layout: Handle) -> Self { + self.layout = layout; + self + } } impl From> for TextureAtlas {