Repository navigation
How to Save Multiple Save Files #32
Slebee
started this conversation in
Master Inventory Engine
Replies: 1 comment
|
First you could setup a class for the data you need to save outside the entity manager data (entity manager data include attributes, custom data, inventory, etc): [System.Serializable]
public class GameSaveData{
public ....
}When save, use: public void Save(GameSaveData _data, int _saveIndex){
string _extraString = JsonUtility.ToJson(_data);
GameManager.EntityManagerData.Save(GameManager.GetFullSavePath("UserSave"+_saveIndex.toString()+".sav"), _extraString );
}When load, use: public void Load(int _saveIndex){
string _extraString = GameManager.EntityManagerData.Load(GameManager.GetFullSavePath("UserSave"+_saveIndex.toString()+".sav"));
GameSaveData _data = (GameSaveData)JsonUtility.FromJson(_extraString , typeof(GameSaveData));
/// your code to deal with the loaded GameSaveData.
}On top of that, you could save the last |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, I'd like to ask for some advice: if I want to allow players to save multiple game files, what would be the best way to go about it?
All reactions