Sorry for sounding noobish if I do, however I am quite good at using Easy Save 2 and love how easy it actually is to use. Im just having an issue with Easy Save 3 saving a gameobject list... It's probably something I am doing wrong, and probably something very simple! However I shall paste the code below for you to point out my errors if you can =)
Code: Select all
public class ES3_Save : MonoBehaviour
{
public void Save()
{
List<GameObject> bricks = new List<GameObject>(GameObject.FindGameObjectsWithTag("Player"));
for (int i = 0; i < bricks.Count; i++)
{
ES3.Save<GameObject>("go" + i.ToString(), bricks, "brickInfo.dat");
Debug.Log("go" + i.ToString());
}
ES3.Save<int>("count", bricks.Count, "brickInfo.dat");
}
}
Code: Select all
public class ES3_Load : MonoBehaviour
{
public void Load()
{
int count = ES3.Load<int>("count", "brickInfo.dat");
List<GameObject> bricks = new List<GameObject>();
for(int i = 0; i < count; i ++)
{
bricks.Add(ES3.Load<GameObject>("go" + i, "brickInfo.dat"));
Debug.Log("go" + i.ToString());
}
}
}
Code also doesn't work for a single gameobject (I can get a single gameobject to save and load but not this way ) Thanks in advance for any advice / pointers =)InvalidCastException: Cannot cast from source type to destination type.