Save file slot with gameplay image

Discussion and help for Easy Save 3
Post Reply
RS_EG
Posts: 3
Joined: Sun May 14, 2023 10:12 pm

Save file slot with gameplay image

Post by RS_EG »

Hello,

Thanks for the tool, I'm not a good programmer so it's saved a lot of headaches with saving :)

I was wondering if it's possible to have a Save/Load UI icon with a gameplay preview image?
Example:
https://www.gameuidatabase.com/uploads/ ... -28250.jpg

I've so far tested by taking a screenshot of gameplay when the player clicks the save button, then applying the Texture2D sprite to an Image component next to the Load button.
Testing with saving the Texture2D works but this made the save file more than 50MBs.
Testing with ES3.SaveImage works with a much smaller file size but at the cost of having an image file in the folder.
I tried saving the Sprite which created a small file size but doesn't seem to load anything when relaunching the game.

I was wondering if there is a way to have the image saved as part of the save file whilst maintaining the file itself respectably small?
Or maybe if I'm overcomplicating things & there is a more efficient way to achieve a Save/Load UI with gameplay image?

Thanks!
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save file slot with gameplay image

Post by Joel »

Hi there,

Saving a Texture2D will save it uncompressed as that's how it's stored internally.

Generally in these cases you would save the image separately, and save the filename of the image in the save file so you know what image to display.

An alternative if you need to have the image in the save file would be to use ES3.SaveImage with the cache, and then use ES3.LoadRawBytes to get the compressed image as a byte array and save this to the file. Then to load, load the byte array, use ES3.SaveRaw to save it to the cache and then ES3.LoadImage to load it from the cache.

A code example of using the cache in this way is here, though you would use SaveImage and LoadImage instead of Save and Load:

https://docs.moodkie.com/easy-save-3/es ... rage-apis/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
RS_EG
Posts: 3
Joined: Sun May 14, 2023 10:12 pm

Re: Save file slot with gameplay image

Post by RS_EG »

Hi Joel,
Thanks for the quick reply
Using the cache sounds like it's above my current capabilities :D

Generally in these cases you would save the image separately, and save the filename of the image in the save file so you know what image to display.
For this method, am I understanding correctly that this would use ES3.SaveImage to save the image as a .jpeg file, then when loading use ES3.LoadImage to create a sprite for the image component?

Thanks!
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save file slot with gameplay image

Post by Joel »

For this method, am I understanding correctly that this would use ES3.SaveImage to save the image as a .jpeg file, then when loading use ES3.LoadImage to create a sprite for the image component?
That is correct :)
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
RS_EG
Posts: 3
Joined: Sun May 14, 2023 10:12 pm

Re: Save file slot with gameplay image

Post by RS_EG »

Appreciate the confirmation, thanks!
Post Reply