Hangs on Load

Discussion and help for Easy Save 3
vrchewal
Posts: 6
Joined: Sun Apr 28, 2019 2:08 am

Hangs on Load

Post by vrchewal »

I can save from code using ES3.Save<GameObject>(SaveName, gameObject); and can see the saved file, with a complete parent -> children structure for the gameobject. In other words, saving seems to work fine. When I attempt to load on Start from the saved file using ES3.Load<GameObject>(SaveName); Unity hangs and I have to kill it and reopen the project. If I try LoadInto, it doesn't hang, but it also doesn't replicate the structure from the saved file.

I tried using the AutoSave feature and it doesn't appear to do anything on load. All components have been added to the custom types list. I'm running out of ideas.

Any idea why saving works fine, LoadInto doesn't hang and yet doesn't work right and Load fails completely?

Thanks in advance for any help!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Load

Post by Joel »

Hi there,

Please could you provide information on the types of Components attached to the GameObject which you've added support for?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
vrchewal
Posts: 6
Joined: Sun Apr 28, 2019 2:08 am

Re: Hangs on Load

Post by vrchewal »

Thanks for the response! The main parent game object is a singleton instance, custom manager script derived from MonoBehavior. It contains references to the other game objects in Lists, all of which are custom types added to the Easy Save types list.

To save time, what is the best way to setup a gameobject and children for saving? I would like to call the save function and know that everything in that hierarchy is saved. When I call the load function, I want to end up with the one manager gameobject and its children exactly as it was left at save.

Thanks for your help!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Load

Post by Joel »

Hi there,

Is your GameObject a prefab instance? If so, have you followed the "Saving and loading prefab instances" section here? https://docs.moodkie.com/easy-save-3/es ... s-prefabs/

If this doesn't solve your issue, please could you make a new basic project which replicates the issue and PM it to me with instructions?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
vrchewal
Posts: 6
Joined: Sun Apr 28, 2019 2:08 am

Re: Hangs on Load

Post by vrchewal »

Thanks again for the support!

It is not a prefab and depending on the needs of the scene, will have a different structure each time. I'll create a skeleton hierarchy, gradually add components and see where it breaks down. I'll post back once I have more information. Thanks!
vrchewal
Posts: 6
Joined: Sun Apr 28, 2019 2:08 am

Re: Hangs on Load

Post by vrchewal »

This is very strange. I have Unity 2019.1.0f2 and Easy Save 3 from the Asset Store. I created an empty scene and have 3 objects in the scene. A camera, save script and a test gameobject. I re-imported ES3 to ensure i have the unmodified version from the store. The gameobject to save has no components and I only changed the transform position so I would know if the save worked. On application quit, the save function works perfectly. Creates the SaveData.es3 with the following data:

Code: Select all

{"SaveName":{"__type":"UnityEngine.GameObject,UnityEngine.CoreModule","value":{"layer":0,"tag":"Untagged","name":"SavedObj","hideFlags":0,"components":[{"__type":"UnityEngine.Transform,UnityEngine.CoreModule","parent":null,"localPosition":{"x":1,"y":2,"z":3},"localRotation":{"x":0,"y":0,"z":0,"w":1},"localScale":{"x":1,"y":1,"z":1}}]}}}
On load, it hangs and doesn't even post debug lines from right before the Load command. The following code is from my input/output script.

Code: Select all

public override void OnLoad()
{
	base.OnLoad();
	if (ES3.KeyExists(SaveName))
	{
		Debug.Log("Load ES3");
		ES3.Load<GameObject>(SaveName);
		Debug.Log("Finished Load ES3");
	}
	else
	{
		Debug.Log("Unable to find ES3 save file for OnLoad.");
	}
}
private void Start()
{
       OnLoad();
}
public override void OnSave()
{
	base.OnSave();
	if(GO) ES3.Save<GameObject>(SaveName, GO);
}
private void OnApplicationQuit()
{
	OnSave();
}
I even tried making a coroutine to delay the load for a couple seconds, which loaded the scene and did everything prior to the Load command and then ended in the same result. I have removed all the custom types in an attempt to prevent outstanding issues. The only other Assets in the Project hierarchy is the AssetStoreTools plugin. I'm at a complete loss as to why this isn't working. There are no errors in the console, it just freezes Unity.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Load

Post by Joel »

Hi there,

Please could you PM me a basic project which replicates this and instructions to replicate it. Hopefully then I will be able to see what is happening.

Also just to clarify, if the Debug lines before the load call aren't being outputted, that means that the Load call isn't being called. I notice you call base.OnLoad() beforehand. Are you sure this isn't being called cyclically, which would cause it to be called infinitely until there is a stack overflow?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
vrchewal
Posts: 6
Joined: Sun Apr 28, 2019 2:08 am

Re: Hangs on Load

Post by vrchewal »

When I comment out the Load call, it doesnt hang up and the debug lines are printed. The parent function is empty, just a placeholder for future QA checks. I will see what I can do about packaging up a project and sending it over.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Hangs on Load

Post by Joel »

Hi there,

Thanks for sending that over. There doesn't appear to be an Easy Save 3 Manager in your scene. This is normally added automatically, but if you uncheck Add Mgr to Scene Automatically in the settings, you will need to manually add the manager. You can do this by going to Assets > Easy Save 3 > Enable Easy Save for Scene.

I'm unsure why it hangs when the manager isn't present in Unity 2019 as it throws an error in earlier versions of Unity. I'll see about getting this resolved for the next update.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
vrchewal
Posts: 6
Joined: Sun Apr 28, 2019 2:08 am

Re: Hangs on Load

Post by vrchewal »

This seems to have worked! Thanks.

I have used ES3 on a different project without the need for the manager in the scene. Just calling Save and Load has worked just fine for me. Is it because its a GameObject that is being loaded that is the issue? I currently have a custom container class type for saving and loading in a different game that is working perfectly, albeit in Unity 5.

One thing I just saw in your release notes is that children are not saved automatically. Is there a way to recreate the hierarchy with children, exactly as it was at save?
Post Reply