Page 1 of 1

Save and load conditions

Posted: Wed Jul 29, 2020 2:27 pm
by nomataka
Hello, I configured Easy save3 on my project a little while ago, the plugin is perfect for what I want to achieve but I have a problem with my automatic save, I would like to use a condition between two scenes to know if my save file is created or not in order to give game logic "new game, game loader" ect .. I have used script api, but it doesn't seem to work.

Re: Save and load conditions

Posted: Wed Jul 29, 2020 3:41 pm
by Joel
Hi there,

You should be able to use ES3.FileExists(yourFileName) to check whether the file exists. would you be able to show me the code you're using?

All the best,
Joel

Re: Save and load conditions

Posted: Wed Jul 29, 2020 10:17 pm
by nomataka

Code: Select all

public class MainMenu : MonoBehaviour
{
    private bool quality = false;
    void Start()
    {

    }

	public void ChargerPartie ()
	{
			if (ES3.FileExists ("SaveFile0.es3")) {



				Application.LoadLevel ("Projet A");

			}
	}

	public void NouvellePartie ()
	{
		ES3.DeleteDirectory ("SaveFile0.es3");
		Application.LoadLevel ("Projet A");

Code: Select all

	private MainMenu main;
	void Start () {
		
		if (ES3.FileExists ("SaveFile0.es3")) {
			ES3AutoSaveMgr.Current.Load ();

		}

	}
	// Update is called once per frame
	void Update () {
		
	}
    public void save()
    {
        ES3AutoSaveMgr.Current.Save();


	
		// Create an ES3File.
		//var es3File = new ES3File("myFile.es3");
    }

    public void load()
	{
		if(ES3.FileExists("SaveFile0.es3")) {
	
			ES3AutoSaveMgr.Current.Load ();

		}

	}
		}


My 2 scripts that I use to save and load my different parts as well as the condition of the existing file at startup. I use buttons as a trigger.

Re: Save and load conditions

Posted: Thu Jul 30, 2020 6:39 am
by Joel
Hi there,

Just to check, is the filename set to SaveFile0.es3 in Window > Easy Save 3 > Auto Save > Advanced Settings?

Also you appear to be using ES3.DeleteDirectory to delete your save file, when you should be using ES3.DeleteFile.

All the best,
Joel

Re: Save and load conditions

Posted: Thu Jul 30, 2020 9:21 am
by nomataka
Great ! I come realised my error, sorry for the disturbance. The system function at the perfection, one thousand thank again ! :D