#Load TextureAtlasHandle from file ?

6 messages · Page 1 of 1 (latest)

stiff onyx
#

In order to display a 2d animation one must obtain 1) a Handle<Image> which can easily be re-used thanks to asset_server, and 2) a Handle<TextureAtlasLayout>, which can be obtained using assets.add(TextureAtlasLayout).

I have 2 issues with that :

  • How do I easily re-use the same handle when spawning the same animation multiple times ?
  • Assuming each spritesheet have it's own layout, I'd like to somehow bundle them together, can I use assets meta for this (or something else) ?

Thanks

scarlet carbon
#

create you own asset, like MyTextureAtlasSprite which has both an Image labeled asset, and TextureAtlas labeled asset, the you can retrieve the labeled assets with asset_server.load("person.my_texture_atlas_sprite#TextureAtlas")

stiff onyx
#

that does the trick, thanks

hasty meadow
#

I am having the same issue, so I hope it's fine if I ask here. Considering I am really new to Bevy (but I did manage to load an Image from a png and add its TextureAtlasLayout as assets), what does it mean:

you can retrieve the labeled assets with asset_server.load("person.my_texture_atlas_sprite#TextureAtlas")

Specifically, I am confused by the dot and hash notation in the string.

scarlet carbon
#

after the dot is just the file extension, i wrote all that but in practice it will be something like json or ron

#

the part after the hash is the labeled asset that is internal to the json