Page 1 of 1

Challenge with saving and loading multiple game objects

Posted: Sun Jul 30, 2023 4:40 am
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?

Re: Challenge with saving and loading multiple game objects

Posted: Sun Jul 30, 2023 8:38 am
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

Re: Challenge with saving and loading multiple game objects

Posted: Sun Jul 30, 2023 3:32 pm
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.

Re: Challenge with saving and loading multiple game objects

Posted: Mon Jul 31, 2023 7:57 am
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

Re: Challenge with saving and loading multiple game objects

Posted: Mon Oct 09, 2023 12:33 pm
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.

Re: Challenge with saving and loading multiple game objects

Posted: Mon Oct 09, 2023 1:06 pm
by Joel
Hi there,

Are you using the latest version of Easy Save? This is present in the current version of Easy Save

Re: Challenge with saving and loading multiple game objects

Posted: Tue Oct 10, 2023 10:52 am
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.