Too many debug messages?

Discussion and help for Easy Save 3
Post Reply
Rogerio
Posts: 8
Joined: Sat Nov 14, 2020 8:29 am

Too many debug messages?

Post by Rogerio »

OK I've been getting to grips with this app for the last few days and IO think I'm about ready to implement it into my game but i've noticed that I'm getting a lot of messages in the console so I just want to check I'm not messing up somewhere.
Is this normal behavior or am I doing something wrong?

Saving one key =
https://i.imgur.com/l6y4d6f.png

Loading one key (Note how it reads the property 3 times) =
https://i.imgur.com/ksVAaWe.png

Saving two keys =
https://i.imgur.com/Yync4eU.png

Loading two keys =
https://i.imgur.com/zQBNztq.png

Thanks in advance.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Too many debug messages?

Post by Joel »

Hi there,

This is because 'Log info' is checked in Window > Easy Save 3 > Settings. By default this should be unchecked, so I'm not sure if you checked this by accident.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Rogerio
Posts: 8
Joined: Sat Nov 14, 2020 8:29 am

Re: Too many debug messages?

Post by Rogerio »

I'm aware I can just turn them all off but the issue isn't that I'm getting log messages but that they appear to be repeating themselves. I'm just trying to check that this is correct behavior. note the pictures provided where the same key gets read multiple times.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Too many debug messages?

Post by Joel »

Hi there,

Would you be able to private message me a basic project which replicates this? Whether it's correct behaviour depends on how your project is structured.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Rogerio
Posts: 8
Joined: Sat Nov 14, 2020 8:29 am

Re: Too many debug messages?

Post by Rogerio »

Not really, I can give you the script I used but I can't give you the project as it contains about 8 months worth of work. Unfortunatly I tested your app using some resources from my project.

Here's the script.

Code: Select all

public class VarsToSave : MonoBehaviour
{

    
    [SerializeField] CharacterSheet characterPrefab = null;

    [SerializeField] List<CharacterSheet> characters = new List<CharacterSheet>();

    CampaignOptions campaignOptions;
    bool test = false;

    private void Start() {

        campaignOptions = FindObjectOfType<CampaignOptions>();
    }

    public void TestSave()
    {
        int index = 0;
        foreach (CharacterSheet character in characters)
        {
            print("SAVING");
            string keyString = "hero ";
            keyString += (index.ToString()+ "/ name: ");
            ES3.Save(keyString, character.GetName());
            keyString = keyString.Replace("/ name: ", "/ gender: ");
            ES3.Save(keyString, character.GetGender());
            index ++;
        }

        //FIXME: Don't forget to delete rest of keys until no more exist
    }

    public void DeleteSave()
    {
        if (test)
        {
            ES3Settings.defaultSettings.path = "Save1.es3";
        }
        else
        {
            ES3Settings.defaultSettings.path = "Save2.es3";
        }

        test = !test;
    }

    public void TestLoad()
    {
        int index = 0;
        for (index = 0; index < characters.Count; index++)
        {
            Destroy(characters[index].gameObject);
        }
        characters.Clear();

        index = 0;
        for (index = 0; index < 1000; index++)
        {
            print("LOADING");
            string keyString = "hero ";
            keyString += (index.ToString() + "/ name: ");
            if (ES3.KeyExists(keyString))
            {
                CharacterSheet character = Instantiate(characterPrefab, transform) as CharacterSheet;
                character.transform.SetParent(this.transform);
                characters.Add(character);
                character.SetName(ES3.Load<string>(keyString));
                keyString = keyString.Replace("/ name: ", "/ gender: ");
                GenderEnum tempGender = ES3.Load<GenderEnum>(keyString);
                character.SetGender(tempGender);
                character.ActivateCharacter(campaignOptions);
            }
            else
            {
                break;
            }
        }
    }

    public void CreateHeroes()
    {
        CharacterSheet character = Instantiate(characterPrefab, transform) as CharacterSheet;
        character.transform.SetParent(this.transform);
        characters.Add(character);
        character.ActivateCharacter(campaignOptions);
    }
}
Additionally, I know this isn't within the scope of this question but is this the correct way of working through prefabs? Thanks a lot.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Too many debug messages?

Post by Joel »

Hi there,

From what I can tell from your script, for your project this is expected as the key gets read when you call ES3.KeyExists, once to navigate to the data and then once to read the data.

This is one way of saving prefabs, though if you wanted it to be more efficient you could save arrays or Lists of your items rather than storing them to individual keys.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Rogerio
Posts: 8
Joined: Sat Nov 14, 2020 8:29 am

Re: Too many debug messages?

Post by Rogerio »

Right, that's making sense then. I'll get started. Thanks for taking the time to address my issues.
Post Reply