- Home /
Deleting Save Files Created By Unity Serializer
I would like to give the user the option to either load a game or delete a game when they click on the save file.
The save files are saved using Unity Serializer and upon reading the documentation, i realised that I have no clue how to delete a saved game.
Can someone help me with source code?
Answer by whydoidoit · Jan 13, 2013 at 02:41 PM
You need to modify the LevelSerializer.SavedGames dictionary for your player/players. Then call LevelSerializer.SaveDataToPlayerPrefs().
SavedGames is keyed off the player's name, which defaults to "" - the contents is a list, so the following will remove all games for a player:
LevelSerializer.SavedGames[LevelSerializer.PlayerName].Clear();
LevelSerializer.SaveDataToPlayerPrefs();
PlayerPrefs.Save();
Or uses JSONLevelSerializer in place of LevelSerializer if you are using JSON functions.
Your answer

Follow this Question
Related Questions
A node in a childnode? 1 Answer
Mouse scroller problem 1 Answer
Shader forge Toggle 3 Answers
Making an animation play when you press down 2 keys 1 Answer
Sims like building script, picture and webplayer included 2 Answers