Saving lot of runtime Objects - Sandbox game

Discussion and help for Easy Save 3
Post Reply
noob_vulcan
Posts: 4
Joined: Mon Apr 25, 2022 4:38 pm

Saving lot of runtime Objects - Sandbox game

Post by noob_vulcan »

Hi,

I'm currently working on a Sandbox game where I want to add a feature to save and load user-created scenes. Users can spawn a lot of items and arrange them as they want. If someone created a castle then I want that castle to load. Also, I'm using a pooling system for the items.

So how can I save the user-created scene/map and can show the saved maps from the menu? I also plan to add the save/load system to the cloud in the future where users can download other users created maps.

Please suggest to me how can I do this with Easy Save.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving lot of runtime Objects - Sandbox game

Post by Joel »

Hi there, and thanks for getting in contact.

How you would achieve this would very much depend on how your project is structured. However, we have a guide on Saving and Loading GameObjects here:

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

The easiest way to do this would be to simply save and load Lists of GameObjects. For example:

Code: Select all

public class SaveManager : MonoBehaviour
{
	// Whenever you instantiate or destroy a prefab instance, add or remove it from this List.
	public List<GameObject> prefabInstances = new List<GameObject>();

	void Start()
	{
		// Load our prefab instances if they exist.
		prefabInstances = ES3.Load("prefabInstances", new List<GameObject>() );
	}
	
	void OnApplicationQuit()
	{
		// Save any prefab instances.
		ES3.Save("prefabInstances", prefabInstances);
	}
}
Regarding the cloud, this is described here:
https://docs.moodkie.com/easy-save-3/es ... -es3cloud/

And for general usage of Easy Save, please see the Getting Started guide:
https://docs.moodkie.com/easy-save-3/getting-started/

Regarding pooling, it wouldn't be possible for a serialiser to have knowledge of how your pooling system works, so if you wanted to use pooled objects as part of the loading process then you would need to manage this yourself.

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