Auto-save not loading references created at runtime ?

Discussion and help for Easy Save 3
Post Reply
kasspip
Posts: 2
Joined: Thu Mar 09, 2023 10:06 pm

Auto-save not loading references created at runtime ?

Post by kasspip »

First, great package, I'm loving it !

But I struggle with one point, even after reading the guide and playing with your exemple package so I feel stupid asking help for this trivial senario.

1- I use the auto-save method, I have a manager gameobject instanting a prefab at runtime.
2- It stores the reference of the spawned prefab's instance.
3- I save the scene and exit.
4- I check the save file, the manager has correctly saved a "_ES3Ref" with the ID of the spawned instance, and the instance saved data is also described below it.
5- I load the scene : the saved prefab is correctly loaded as well as all variables of the manager exept for that reference which is null !

What I am missing ?
Thanks
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Auto-save not loading references created at runtime ?

Post by Joel »

Hi there,

This is likely because the GameObject containing the reference to the prefab instance is loaded before the prefab instance. In this case loading twice should allow the reference to be loaded.

You can manually trigger Auto Save to load twice from a script by calling ES3AutoSaveMgr.Current.Load() twice. It’s recommended to set the Save Event and Load Event to None when manually triggering Auto Save from code also. Let me know if you need any help with this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
kasspip
Posts: 2
Joined: Thu Mar 09, 2023 10:06 pm

Re: Auto-save not loading references created at runtime ?

Post by kasspip »

That was it !
I set auto-save events to none and called manually ES3AutoSaveMgr.Current.Save() and ES3AutoSaveMgr.Current.Load() twice and it's now working as expected.

Thank you for your support !
Post Reply