-
I have a 2D terrain system that loads in chunks as images (basically like minecraft chunks and render distance). In this case, chunks are just an image that is generated at runtime based on a seed. The issue is that i can't see any other way of spawning these chunks other than saving the image to disk, then loading them back in. This is because spawning a SpriteBundle requires an image handle rather than the actual image. Is there a way to spawn the chunk into the world without loading the image from disk? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After generating the Image you should be able to directly add it to the assets collection fn generate_images(mut images: ResMut<Assets<Image>>) {
let image: Image = ..generate your image;
let handle = images.add(image);
// save the handle or directly use it
} This does not save the image on disc. |
Beta Was this translation helpful? Give feedback.
After generating the Image you should be able to directly add it to the assets collection
This does not save the image on disc.