REQUEST EXAMPLES AND TUTORIALS HERE

Examples using Easy Save's API code
User avatar
Joel
Moodkie Staff
Posts: 4986
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

BuckraMega wrote: Thu Oct 26, 2023 6:42 pm Greetings,

I have been able to get ES3 up and running with little trouble on a standalone Windows version of my game. I'm swapping between 2 save files in case one gets corrupted, making directories, multiple users, the whole deal. But I cannot for the life of me get it to work with WebGL. It seems to be saving just fine, but if I refresh the page and try to load, the game reports that no save file exists. Is there some trick/something different that needs to be done for WebGL? I've dug around the documentation on the site here and I am not finding anything to help.

Thanks!
Hi there,

You shouldn't need to do anything special for WebGL, though note that some Unity events aren't supported on WebGL (for example OnApplicationQuit isn't supported on WebGL), so you should ensure that your events are being called.

If you create a new thread in General Discussion with more information regarding this I can provide support as this thread is for example requests.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Thoreandon
Posts: 1
Joined: Sun Jun 30, 2024 7:53 am

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Thoreandon »

TLDR: How can i save a transform.child in a transform.parent so it gets parented when loaded?

For Example, i Have a GameObject with a BoxContainer Script attached.
The Transform of this BoxContainer is parent of another prefab, lets call it Food.cs
(So in "reality", its a Box with some food in it)

I can ES3.Save("box",boxGO) but this does not save the Food.
So i also need to do ES3.Save("food",foodGO);

For loading i do:
ES3.Load("food");
ES3.Load("box");
But this does not parent to food to the box transform.
I added Fields to both Box and Food for the reference of the Transform. It saves the Ref. but does not parent it.
Do i have to manualy parent it or is there a way to do it.
Also, is there a better way of doing all that or is my approach correct?
Thanks for answering.

Here is the ES3.save file, perhaps it helps.

Code: Select all

"food" : {
		"__type" : "Foodtest,Assembly-CSharp",
		"value" : {
			"_ES3Ref" : "6103288101539495131",
			"goID" : "4880054364478017419",
			"someData" : "Teststring",
			"parent" : {
				"_ES3Ref" : "1495647968566916867"
			}
		}
	},
	"box" : {
		"__type" : "Boxtest,Assembly-CSharp",
		"value" : {
			"_ES3Ref" : "565452272709369311",
			"goID" : "8172930597933057715",
			"food" : {
				"_ES3Ref" : "6103288101539495131"
			},
			"myTransform" : {
				"_ES3Ref" : "1495647968566916867"
			}
		}
	},
User avatar
Joel
Moodkie Staff
Posts: 4986
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

Thoreandon wrote: Sun Jun 30, 2024 8:45 am TLDR: How can i save a transform.child in a transform.parent so it gets parented when loaded?
Just saving and loading the GameObject will save

For Example, i Have a GameObject with a BoxContainer Script attached.
The Transform of this BoxContainer is parent of another prefab, lets call it Food.cs
(So in "reality", its a Box with some food in it)

I can ES3.Save("box",boxGO) but this does not save the Food.
So i also need to do ES3.Save("food",foodGO);

For loading i do:
ES3.Load("food");
ES3.Load("box");
But this does not parent to food to the box transform.
I added Fields to both Box and Food for the reference of the Transform. It saves the Ref. but does not parent it.
Do i have to manualy parent it or is there a way to do it.
Also, is there a better way of doing all that or is my approach correct?
Thanks for answering.

Here is the ES3.save file, perhaps it helps.

Code: Select all

"food" : {
		"__type" : "Foodtest,Assembly-CSharp",
		"value" : {
			"_ES3Ref" : "6103288101539495131",
			"goID" : "4880054364478017419",
			"someData" : "Teststring",
			"parent" : {
				"_ES3Ref" : "1495647968566916867"
			}
		}
	},
	"box" : {
		"__type" : "Boxtest,Assembly-CSharp",
		"value" : {
			"_ES3Ref" : "565452272709369311",
			"goID" : "8172930597933057715",
			"food" : {
				"_ES3Ref" : "6103288101539495131"
			},
			"myTransform" : {
				"_ES3Ref" : "1495647968566916867"
			}
		}
	},
Hi there,

Parenting should be automatic, and by default saving the parent will also save the child. If this isn't happening for you please could you replicate this in a new project with a very simple scene and send me a link to it on moodkie.com/contact (don't post it here as this is a public forum). You should also check that you're using the latest version of Easy Save.

Also if you have further questions please could you create a new thread in General Discussion as this is a support request rather than a general tutorial request. Thanks :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
GreenHousePotato
Posts: 1
Joined: Mon Jul 08, 2024 9:08 am

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by GreenHousePotato »

Hi

I've got question related to caching files.
In my game I've got many scenes. When I'm starting my game I'm creating cache of file that stores my save data. User move's around and changes scenes. On all scene changes I'm saving items related to that scenes (still into cache file). When user triggers Save I'm saving those data into pernament file. All of it works just fine.
I'm having problem with loading. So when loading I want to load data from file (persistent on disk). It is loading data just fine. But how then when I'm trying to cache loaded file to cache (to keep working on non persistent data) it is not getting replace.

From code stand point.

When game starts I'm starting by makeing sure file exist if it doesnt I'm creating one.
if (ES3.FileExists(filePath) == false)
ES3.Save("Game version", Application.version, filePath);

Then I'm creating cache
ES3Settings cachedSaveSettings = new(filePath), ES3.Location.Cache);
Then I'm saving to those cached settings when changing scenes

And when I'm loading data
Version_1 It work's but I'm no longer working on cache

ES3Settings savedInFileSettings= new(filePath, ES3.Location.File);
cachedSaveSettings = savedInFileSettings

Version_2 It does not work. It keep's loading my previous version of cache
ES3Settings savedInFileSettings= new(filePath, ES3.Location.Cache);
cachedSaveSettings = savedInFileSettings

To summarize
How can I clear or replace existing ES3Settings that was cached with new cache from file ?
User avatar
Joel
Moodkie Staff
Posts: 4986
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

GreenHousePotato wrote: Mon Jul 08, 2024 11:55 am Hi

I've got question related to caching files.
In my game I've got many scenes. When I'm starting my game I'm creating cache of file that stores my save data. User move's around and changes scenes. On all scene changes I'm saving items related to that scenes (still into cache file). When user triggers Save I'm saving those data into pernament file. All of it works just fine.
I'm having problem with loading. So when loading I want to load data from file (persistent on disk). It is loading data just fine. But how then when I'm trying to cache loaded file to cache (to keep working on non persistent data) it is not getting replace.

From code stand point.

When game starts I'm starting by makeing sure file exist if it doesnt I'm creating one.
if (ES3.FileExists(filePath) == false)
ES3.Save("Game version", Application.version, filePath);

Then I'm creating cache
ES3Settings cachedSaveSettings = new(filePath), ES3.Location.Cache);
Then I'm saving to those cached settings when changing scenes

And when I'm loading data
Version_1 It work's but I'm no longer working on cache

ES3Settings savedInFileSettings= new(filePath, ES3.Location.File);
cachedSaveSettings = savedInFileSettings

Version_2 It does not work. It keep's loading my previous version of cache
ES3Settings savedInFileSettings= new(filePath, ES3.Location.Cache);
cachedSaveSettings = savedInFileSettings

To summarize
How can I clear or replace existing ES3Settings that was cached with new cache from file ?
Hi there,

Please could you post this as a new thread in General Discussion as this thread is for scene example requests rather than support.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
lockhighjumpingvenus
Posts: 14
Joined: Wed Oct 11, 2023 9:52 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by lockhighjumpingvenus »

Are there any examples of saving a material that uses a custom shader, with custom properties?
User avatar
Joel
Moodkie Staff
Posts: 4986
Joined: Wed Nov 07, 2012 10:32 pm

Re: REQUEST EXAMPLES AND TUTORIALS HERE

Post by Joel »

lockhighjumpingvenus wrote: Wed Aug 28, 2024 2:42 pm Are there any examples of saving a material that uses a custom shader, with custom properties?
Hi there,

Assuming the shader and properties are serializable at runtime, Easy Save will do this automatically if you're using 2019.3 or newer and your custom properties are a Color, Float, Range, Vector or a Texture for which a reference exists. So you would save the Material in the same way as any other data. If this isn't working for you then it would suggest that the Material (or it's Texture) isn't serializable at runtime.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply