Example #1
0
    public ScoreData(ScoreboardScore ScoreboardData)
    {
        Name  = ScoreboardData.Name.text;
        Name1 = ScoreboardData.Name1.text;
        Name2 = ScoreboardData.Name2.text;

        Score  = ScoreboardData.Score.text;
        Score1 = ScoreboardData.Score1.text;
        Score2 = ScoreboardData.Score2.text;
    }
    public static void SaveScore(ScoreboardScore ScoreboardData)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/ScoreData.json";

        using (FileStream stream = new FileStream(path, FileMode.Create))
        {
            ScoreData data = new ScoreData(ScoreboardData);
            formatter.Serialize(stream, data);
        }
    }