edited October 2015 in General Discussion
i have been asking around on different forums and such so i figured i also post this question here im trying to work out how to do binary saving with slots so.

so im doing a basic structure like so ...
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public class saveLoad {

public static List<GameInfoDataBase> SavedGames = new List<GameInfoDataBase>();

public static void Save() {
saveLoad.SavedGames.Add(GameInfoDataBase.GameDB);
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/Data.NissYokuGames");
bf.Serialize(file, saveLoad.SavedGames);
file.Close();
Debug.Log(Application.persistentDataPath);

}

public static void Load() {

if (File.Exists(Application.persistentDataPath + "/Data.NissYokuGames")) {
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(Application.persistentDataPath + "/Data.NissYokuGames", FileMode.Open);
saveLoad.SavedGames = (List<GameInfoDataBase>)bf.Deserialize(file);
file.Close();

Debug.Log(SavedGames.Count);

Debug.Log(Application.persistentDataPath);
}



}

}


then on start im doing this to pull the info after the load game button is pressed
for(int i = 0; i < saveLoad.SavedGames.Count; i++)
{
//additional code here..

}


im just wondering if im going about this the right way or not.
Post edited by wtyson on
new website can be found here http://www.fore-loregames.com

Follow the game Development on Twitter https://twitter.com/Fore_Lore_Games

or check out the face book page here https://www.facebook.com/ForeLoreGames
Sign In or Register to comment.