Save and load conditions

Discussion and help for Easy Save 3
Post Reply
nomataka
Posts: 4
Joined: Thu Jun 25, 2020 5:17 pm

Save and load conditions

Post 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.

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

Re: Save and load conditions

Post 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
Joel @ Moodkie Interactive
Twitter - Unity

nomataka
Posts: 4
Joined: Thu Jun 25, 2020 5:17 pm

Re: Save and load conditions

Post 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.

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

Re: Save and load conditions

Post 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
Joel @ Moodkie Interactive
Twitter - Unity

nomataka
Posts: 4
Joined: Thu Jun 25, 2020 5:17 pm

Re: Save and load conditions

Post by nomataka »

Great ! I come realised my error, sorry for the disturbance. The system function at the perfection, one thousand thank again ! :D

Post Reply