Saving a dictionary does not work after loading the game later.

Discussion and help for Easy Save 3
danosono
Posts: 14
Joined: Mon Feb 21, 2022 12:58 pm

Saving a dictionary does not work after loading the game later.

Post by danosono »

Hi all,

I must be doing something wrong :)

Can anyone see my error here?

Code: Select all

void Start()
        {
            //EnlistDictionaries(); 
            if (ES3.KeyExists("GenesisSaveKey"))
            {
                Genesis = ES3.Load("GenesisSaveKey", DefaultDictionary);
            }
            
        }

        
        private void OnApplicationQuit()
        {
            ES3.Save("GenesisSaveKey", Genesis);   
        }

Thanks!

Danny
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving a dictionary does not work after loading the game later.

Post by Joel »

Hi there,

We’ve had no reports of Dictionaries not loading correctly, and I wasn’t able to replicate it from what you sent.

Please could you create a new project with a simple scene which replicates it and private message it to me with instructions so I can see what is happening.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
danosono
Posts: 14
Joined: Mon Feb 21, 2022 12:58 pm

Re: Saving a dictionary does not work after loading the game later.

Post by danosono »

Joel,

I composed a PM to you and clicked "Submit" but it sits in my Outbox so that I have a number next to my outbox but no "Sent" messages.

How do I send a PM?

Thanks

Danny
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving a dictionary does not work after loading the game later.

Post by Joel »

Hi there,

Private messages remain in the Outbox until the recipient reads them (silly I know, but it's set at phpBB's end so not something we can change). I'll respond to your private message shortly.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving a dictionary does not work after loading the game later.

Post by Joel »

Hi Danny,

Thanks for sending that over, much appreciated. I thought I would respond here rather than PM in case anyone else has a similar issue.

The problem is that you're not assigning the output of ES3.Load back to your variable. Your code is this:

Code: Select all

ES3.Load("MockDictionary", DefaultDictionary);
When it should be this:

Code: Select all

MockDictionary = ES3.Load("MockDictionary", DefaultDictionary);
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
danosono
Posts: 14
Joined: Mon Feb 21, 2022 12:58 pm

Re: Saving a dictionary does not work after loading the game later.

Post by danosono »

OO
Thanks sm!

I was not trying to rush your answer; just wasn't sure I was doing it right.
danosono
Posts: 14
Joined: Mon Feb 21, 2022 12:58 pm

Re: Saving a dictionary does not work after loading the game later.

Post by danosono »

Thanks again Joel,

1. That didn't fix my sample project; still does not load after reloading the scene.
2. I already had that correct assignment in my original project.

When you made that change on my sample project, did it work?

Maybe I am missing something simple again.

Danny
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving a dictionary does not work after loading the game later.

Post by Joel »

Hi Danny,

It indeed worked in the test project. I recommend deleting your previous save data by going to Tools > Easy Save 3 > Clear Persistent Data Path, in case this is interfering.

Just to check, are you entering and exiting play mode? If you're switching scenes rather than entering and exiting play mode, your ES3.Save call won't be called because you've put it in OnApplicationQuit().

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
danosono
Posts: 14
Joined: Mon Feb 21, 2022 12:58 pm

Re: Saving a dictionary does not work after loading the game later.

Post by danosono »

Thanks Joel and sorry for being short in my last reply,

I will try deleting previous data as you suggested but I am getting the expected saved data while in play mode and then no data after exiting play mode and starting again.

I tried exiting play mode and re-entering.

Still not sure what is going on.

I will do as you have suggested ...

Thanks!

Danny
danosono
Posts: 14
Joined: Mon Feb 21, 2022 12:58 pm

Re: Saving a dictionary does not work after loading the game later.

Post by danosono »

Hello Joel :)

I got the test proj. working O_O

All I did was extract the save and load calls to respective methods and called the methods in ApplicationQuit and Start.

I only did this b/c I wanted to add the methods to the context menu for better control of when they are called; I never had to call them in the editor b/c it was working.

Crazy?

I am starting work now so I will test this in my project afterwards.

Thanks again!

Danny
Post Reply