Challenge with saving and loading multiple game objects

Discussion and help for Easy Save 3
Post Reply
geebeanie
Posts: 2
Joined: Sun Jul 30, 2023 4:36 am

Challenge with saving and loading multiple game objects

Post by geebeanie »

Hi there! I'm trying to save and load an array of GameObjects. The saving seems to work well, but I am faced with an error when it comes to loading.

Save code --
allCrops = GameObject.FindGameObjectsWithTag("Crop");
ES3.Save("plantedCrops", allCrops);

Load code --
ES3.Load("plantedCrops");

When I run this code, I can see the saved objects appear in the scene (although it messes up the save of other parameters) and am hit with this error message:
InvalidOperationException: alphaHitTestMinimumThreshold should not be modified on a texture not readeable or not using Crunch Compression.

Full error message is attached. Please advise if I am doing something wrong?
Attachments
errormsg.txt
(2.34 KiB) Downloaded 96 times
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Challenge with saving and loading multiple game objects

Post by Joel »

Hi there,

This indicates that you're saving a Texture which isn't marked as read/write enabled in its settings.

For information on how to do this please see Unity's docs:

https://docs.unity3d.com/ScriptReferenc ... 20textures.

You should also consider whether you actually need to save the Texture itself, or just a reference to it, or just allow it to remain as default. For example if your Texture doesn't change and the GameObject isn't generated at runtime then you probably don't need to save it. If the Texture is swapped but the pixels themselves aren't changed, you likely only need to save it by reference. Only if you're modifying the Texture itself will you actually need save the Texture data.

Let me know if you would like more information on this.

If you haven't done so already I also strongly recommend reading the Saving and Loading GameObjects guide which contains information on which Components will and won't be saved by default, and how to work with Prefabs if this is relevant to you:

https://docs.moodkie.com/easy-save-3/es ... s-prefabs/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
geebeanie
Posts: 2
Joined: Sun Jul 30, 2023 4:36 am

Re: Challenge with saving and loading multiple game objects

Post by geebeanie »

Hi Joel,

Thank you for the quick reply!

Can you please share how I can successfully disable the saving of Textures? I tried using the EasySave types Window to disable the Texture components but it threw errors and stopped me from compiling.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Challenge with saving and loading multiple game objects

Post by Joel »

Hi there,

The easiest way would be to add an ES3GameObject Component to the GameObject(s) you're saving and unchecking the renderer which references the Texture.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
LewyT
Posts: 3
Joined: Wed May 31, 2023 12:11 pm

Re: Challenge with saving and loading multiple game objects

Post by LewyT »

Please clarify what you mean by ES3GameObject component.
I don't see that in the list of components I can add to a game object.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Challenge with saving and loading multiple game objects

Post by Joel »

Hi there,

Are you using the latest version of Easy Save? This is present in the current version of Easy Save
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
LewyT
Posts: 3
Joined: Wed May 31, 2023 12:11 pm

Re: Challenge with saving and loading multiple game objects

Post by LewyT »

Thanks for the help, Joel, I am editing my last post.
I had downloaded the latest version but apparently I forgot to re-import it into my project: rookie mistake.
Now I have imported and I can add a ES3GameObject component to the objects that cause errors.
I can confirmed that the error is no longer happening with one game object I added it to.
Post Reply