More Dictionary Help

Discussion and help for Easy Save 3
Post Reply
Notso
Posts: 51
Joined: Sat May 08, 2021 6:53 pm

More Dictionary Help

Post by Notso »

So I have a logo screen the only purpose is to load the 4 or 5 DoNotDestroy objects I use throughout the game so they will never be duplicated or lose references or referenced by others.
1 of these I use to store a list in the editor of key/value pairs which then, on Load, it copies these to a dictionary (startinggamestates to gamestatedictionary) which the mission system then checks to see if it a value has been changed to give/complete/fail a mission.
The odd issue is, no matter what I try (ES3, custom system or other) I just can't get that thing to change the values on load.
I check the save files and they are there fine. it lists them and the correct values. However on load, it runs the load but the values do not change.
I even put the es3load in a method and on start set a 20f invoke delay just to make sure all the new scene resets are finished. Then a 5sec delay to loop through and debug the values out. (I know these times are excessive, they are of course only there for testing)
The onstate.change is a custom method that gets called whenever a value is changed.

Code: Select all

 private void Start()
    {
         Invoke("LoadAppMan", 20f);
    }
    private void LoadAppMan()
    {
        if (ES3.KeyExists("gamestatedictionarySaveKey"))
        {
            Debug.Log("I loaded the es3 save values");
            _gameStateDictionary = ES3.Load("gamestatedictionarySaveKey", _gameStateDictionary);
        }
        Invoke("DictionaryTest", 5f);
    }
    
    
           void DictionaryTest()
    {
        OnStateChanged.Invoke();
        foreach (var element in _gameStateDictionary)
        {
            Debug.LogFormat("Done Loaded: Dictionary is now reading:  (Key = {0},Value = {1})", element.Key, element.Value);
        }
    }
    
            
    }
        private void OnApplicationQuit()
    {
        ES3.Save("gamestatedictionarySaveKey", _gameStateDictionary);   
    }
    
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: More Dictionary Help

Post by Joel »

Hi there,

Unfortunately it's not possible to tell what is happening from what you've sent. Please could you replicate your issue in a new project with a simple scene and private message it to me with step by step instructions.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Notso
Posts: 51
Joined: Sat May 08, 2021 6:53 pm

Re: More Dictionary Help

Post by Notso »

Figured you were going to ask for one. I sent a project link and a video link to show explain what is happening.
Post Reply