I'm working on some games that are suppose to communicate with one another trough a file. One of the things i am trying to send between the games is a sprite and an audioclip but it doesn't seem to work. I'm using the following class.
[Serializable]
class Data
{
public Sprite spriteToSend;
public AudioClip clipToSend;
}
I'm also using BinaryFormatter to save my data like so
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath +"/Data.dat");
Data data = new ;
bf.Serialize(file, data);
file.Close();
and to load it like so
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(Application.persistentDataPath + "\\Data.dat", FileMode.Open);
Data data = (Data)bf.Deserialize(file);
file.Close();
but when i run it i get an error that says sprites and audioclips cant be Serialized.
Am i doing something wrong or how can i solve this problem?