Exemplo n.º 1
0
    /// <summary>
    /// Save data from path
    /// </summary>
    public void Save(PersistantData data)
    {
        if (!data.GetType().IsSerializable)
        {
            return;
        }

        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + data.GetFilePath());

        bf.Serialize(file, data);
        file.Close();
        Debug.Log(data.GetFilePath() + " saved!");
    }
Exemplo n.º 2
0
    /// <summary>
    /// Save data from path
    /// </summary>
	public static void Save(PersistantData data)
    {
		if (!data.GetType().IsSerializable)
		{
            Debug.LogWarning("NOT SERIALIZABLE");
			return;
		}

        BinaryFormatter bf = new BinaryFormatter();
		FileStream file = File.Create(Application.streamingAssetsPath + "/" + data.GetFilePath());

		bf.Serialize(file, data);
        file.Close();
        Debug.Log("<color=red>" + data.GetFilePath() + " saved!</color>");
    }