I’ve been looking at the example for SpriteManager however I cannot find a way to provide separate sprites instead of spritesheet or sprite atlas.
What I would like to do is to give an array (or a structure that Babylon accepts) of separate images like this. The thing is my assets library is mostly made of separate images like this and I don’t want to convert them to spritesheets.
[“walk1.png”, “walk2.png”, “walk3.png”]
Any ideas?
I don’t think we can do that, except by creating as many sprite managers as you have sprites. It’s possible to do this if you only have a small number of sprites, but it’s not practical if you have dozens or more.
Instead, you will need to create a helper function to create a single texture from a list of images and pass it to the sprite manager constructor.
2 Likes
Thanks. Yeah, I think there’s no way to do that. Weird design. But anyway.
I’ve used this below package to create a spritesheet on the fly that Babylon wants. Before I use SpriteManager, I send separate images to a function that uses this library. The function returns a blob and I use this blob image as the texture URL. Works fine and I don’t need to pre-format my images in TexturePacker or similar. Pretty light library.