Forum rules - please read before posting.

Save games - Questions

edited January 2015 in Technical Q&A
Hi Guys
I have a question.  How can I Reset a a game to delate all saved games ?

Comments

  • A bit of custom scripting would do it, which you could place in a custom Action.

    When you overwrite an existing save, AC actually deletes the old file first - you can use the same code to do the job.  Something like this should do it:

    void DeleteSaveFile (string fullFileName)
    {
        FileInfo t = new FileInfo (fullFileName);
        if (t.Exists)
        {
            t.Delete ();
        }
    }


    The function requires the filename as a parameter.  To get the filename given a save ID (the slot number), try this:

    private string GetSaveFileName (int saveID)
    {
        string fileName = "";
        #if UNITY_WEBPLAYER || UNITY_WINRT
        fileName = GetProjectName () + "_" + saveID.ToString ();
        #else
        fileName = saveDirectory + Path.DirectorySeparatorChar.ToString () + GetProjectName () + "_" + saveID.ToString () + saveExtention;
        #endif

        return (fileName);
    }


    So your Action could then run something like:

    DeleteSaveFile (GetSaveFileName (0));
    DeleteSaveFile (GetSaveFileName (1));
    DeleteSaveFile (GetSaveFileName (2));
    DeleteSaveFile (GetSaveFileName (3));
  • Thanks Chris

    Other Question. How I should set up a "reset Game " action ?  That action should restart all game settings and  put a player in the start poitn of the game ?
  • edited January 2015

  • Ok never mind  I figured out that ;)
  • edited October 2018
    Thanks..
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.