Easy Save saves my prefabs, but loads very weirdly...

Discussion and help for Easy Save 3, The Complete Save Game & Data Serializer System for the Unity Engine
Post Reply
LKBlackmon
Posts: 3
Joined: Wed Jan 31, 2024 8:15 am

Easy Save saves my prefabs, but loads very weirdly...

Post by LKBlackmon »

Hello all,

I have encountered an issue that I am hoping someone can help me solve. I can save my prefabs using Easy Save, no problem. It creates a json file and I can see every prefab I have placed at runtime for testing purposes. Whatever prefabs I spawned in are all inside the file when I open it and review it. But for whatever reason, when I load that exact same json file, it loads one prefab, and worse, that prefab isn't even one of the ones I used for testing. This happens no matter how many new save files I create. If I have 10 save files with different names (and different prefabs that were saved inside of them), I get 10 loads of the exact same prefab. I am using a file browser to create the save file, so that the user can name their own save files and choose the save location. I don't think that has anything to do with what's happening, but I mention it just in case.

My method for loading is as follows:

public void LoadPrefabInstances()
{
var paths = StandaloneFileBrowser.OpenFilePanel("Title", "", "json", false);
if (paths.Length > 0)
{
prefabInstances = ES3.Load("prefabInstances", new List<GameObject>());
Debug.Log("Loading!");
}
}

I do see "Loading!" when I load the file. I just don't know what I have done wrong that's causing my load method to create this single lone prefab every time.

Also, I thought using Refresh from my Easy Save 3 Manager might help resolve the issue, but every time I hit refresh, a loading bar pops up and says Easy Save is doing things, before it finally moves to saying Unity is waiting to finish....but hangs up and never finishes. I let it go for an hour and a half tonight before I finally used the task manager to shut it down. I've since tried this several times (though I didn't go an hour and a half again), and each time it does it's Easy Save thing before moving to the "Unity is waiting to finish" message and hanging up again. Maybe my issue is tied to needing to refresh the ES3Prefabs list on the manager and not being able to?

I should probably mention I have, at last count, around 1500 prefabs. The last time I was able to get Easy Save to update before the whole hanging up thing started, my prefab count had doubled to over 3000 without me adding any new prefabs. Something is messed up, but I don't know what. Any help would be greatly appreciated. Thank you!
User avatar
Joel
Moodkie Staff
Posts: 4988
Joined: Wed Nov 07, 2012 10:32 pm

Re: Easy Save saves my prefabs, but loads very weirdly...

Post by Joel »

Hi there,

First I would check that the prefabInstances List you're saving contains the items you expect it to immediately before saving (i.e. using a Debug.Log call), and that they are all different instances (rather than adding the same instance to the list many times).

Secondly, have you copied any ES3Prefab Components (or any prefabs containing these Components)? If so, each of the prefabs will have the same prefab ID which will cause issues. In this case you would need to remove the duplicate ES3Prefab Components and re-add them using right-click > Easy Save 3 > Enable Easy Save for Prefab. This will ensure each one has a different prefab ID.

If this doesn't solve your problem I recommend trying to replicate it in a new project with a simple scene to try to isolate the issue to either Easy Save or your logic.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
LKBlackmon
Posts: 3
Joined: Wed Jan 31, 2024 8:15 am

Re: Easy Save saves my prefabs, but loads very weirdly...

Post by LKBlackmon »

Hi Joel,

My prefabinstances list only shows the items that I have generated while in play mode. While testing I would put two or three prefabs down and move them about to different places, just so I could check how saving rotation and position was working. And while playing I could see those prefabs in the prefabinstances list being generated at runtime. The list is working well.

I have double checked that I don't have any extra ES3Prefab components on any of my prefabs. There's only one instance of the script on each prefab. I did add them initially using the method you described by right clicking and choosing Enable Easy Save for Prefab.

Lastly, I created a new project (Unity 2022.3.15f, if that makes a difference), added easy save and my scripts, as well as Runtime Level Design, then tested it. It once again saved the prefabs I had spawned (I can see them in the json file when I open it), but it loads nothing now. I expected it would at least spawn one prefab since that's what it was doing last night. Any other ideas? I can share the file I created with you if you like. It's around 630 MB though, so it looks like I can't attach it to the forums.
User avatar
Joel
Moodkie Staff
Posts: 4988
Joined: Wed Nov 07, 2012 10:32 pm

Re: Easy Save saves my prefabs, but loads very weirdly...

Post by Joel »

Hi there,

Assuming that the project is minimal and I don't need knowledge of the asset you're using to understand it: If you upload the project to something such as Google Drive or WeTransfer and send me the link using the form at Moodkie.com/contact along with step-by-step instructions I'm happy to take a look.

Also just to clarify, my suggestion wasn't to check for duplicate ES3Prefab components. It was to check that the objects they're attached to haven't been copied. For example let's say you create a Prefab called Prefab A and Enable Easy for Prefab on it. If you then make a copy of Prefab A (let's call this copy Prefab B), then Prefab B will have the same Prefab ID as Prefab A (which would prevent Easy Save from determining the difference between them). However, it doesn't seem like this is the case from what you've described.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
LKBlackmon
Posts: 3
Joined: Wed Jan 31, 2024 8:15 am

Re: Easy Save saves my prefabs, but loads very weirdly...

Post by LKBlackmon »

Thank you Joel,

I have uploaded a copy of the file and shared it with you via the contact form at moodkie.com. I really appreciate the help!

Lanndon
Post Reply