Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify Texture Atlas rework migration guide #1028

Merged
10 changes: 8 additions & 2 deletions content/learn/migration-guides/0.12-to-0.13.md
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,10 @@ Renamed `PbrInput::occlusion` to `diffuse_occlusion`, and added `specular_occlus
<div class="migration-guide-area-tag">Rendering</div>
</div>

The `TextureAtlas` asset that previously contained both the atlas layout and image handle has been renamed to `TextureAtlasLayout` that only contains the layout now. A separate `Handle<Image>`gotten through either `SpriteSheetBundle::texture` or `AtlasImageBundle::image` replaces the prior image handle functionality of `TextureAtlasLayout`.

`TextureAtlasSprite` was removed and replaced by a new component, `TextureAtlas`, which now holds the atlas index and is a direct component of `SpriteSheetBundle` replacing the `Handle<TextureAtlasLayout>` from before. The `Sprite` component can be used for `flip_x`, `flip_y`, `custom_size`, `anchor`, and `color` and replaces `TextureAtlasSprite` in `SpriteSheetBundle`.

- Sprites

```diff
Expand All @@ -894,12 +898,14 @@ fn my_system(
commands.spawn(SpriteSheetBundle {
- sprite: TextureAtlasSprite::new(0),
- texture_atlas: atlas_handle,
// the new sprite initialization is covered by the `..default()` expression; however, it is added to showcase migration
+ sprite: Sprite::default()
+ atlas: TextureAtlas {
+ layout: layout_handle,
+ index: 0
+ },
+ texture: texture_handle,
..Default::default()
..default()
});
}
```
Expand Down Expand Up @@ -933,7 +939,7 @@ fn my_system(
+ flip_x: false,
+ flip_y: false,
+ },
..Default::default()
..default()
});
}
```
Expand Down