Page 1 of 1

Proper way to save scriptable objects/read save file

Posted: Fri Jul 23, 2021 12:53 am
by syu15
Hello,
I have a prefab with a script on it which is referencing some scriptable objects. The nested data in the scriptable object is being modified during gameplay and then I am saving the script when the game quits. Since scriptable object data persists after play mode has exited, I am having trouble figuring out if the scriptable objects are being saved by Easy Save or not. When I open up the JSON save file, I only see hashes next to the scriptable objects like so:

Code: Select all

	{
		"__type" : "FurnitureHelper,Assembly-CSharp",
		"_ES3Ref" : "5823137606146563824",
		"goID" : "8201234751940344136",
		"FloorFurniture" : {
			"_ES3Ref" : "9139268332010462639"
		},
		"BedFurniture" : {
			"_ES3Ref" : "110543471606065824"
		},
		"WallLFurniture" : {
			"_ES3Ref" : "3740186123906972086"
		},
		"WallRFurniture" : {
			"_ES3Ref" : "5631097052467397900"
		}
	}
Does that mean that the nested data inside the scriptable object isn't getting saved or is that to be expected? If so, is there a way to see what is getting saved inside of the scriptable object? They do have nested classes/fields inside of them but I have generated a separate type for those as well so I thought I was doing that correctly.

Re: Proper way to save scriptable objects/read save file

Posted: Fri Jul 23, 2021 7:17 am
by Joel
Hi there,

Fields of UnityEngine.Object types are saved by reference. If you want to save them by value you should either save them using separate ES3.Save calls or put them into an array and save that.

For more information on what gets saved and how, please see the Supported Types guide:
https://docs.moodkie.com/easy-save-3/es ... ted-types/

All the best,
Joel

Re: Proper way to save scriptable objects/read save file

Posted: Thu Aug 05, 2021 5:42 am
by syu15
Ok, thanks for the explanation!