I am having a new issue which I am not sure how to go about resolving. I am getting this error :
Code: Select all
ArgumentException: Only types of UnityEngine.Component can be written with this method, but argument given is type of GameData
Code: Select all
public class GameData: MonoBehaviour {
public string pd = "GameData.es3";
public Player player;
}
The scene already contains this gameObject which already has a GameData component attached to it and it looks like the fact that this is the case may cause the error because when I remove the GameData component from that gameObject I am not getting the above error. But I don't have the slightest clue about why that's the case The thing is, the GameData component has to be there all the time because it holds references to the ui data bind variables, so I really need to have it present at all times and just substitute all its values on load.
My save method(which gives the original exception error) is this :
Code: Select all
if(!ES3.FileExists("GameData.es3")) {
GameData gameData = new GameData();
/* First Time Initialization of Game Data */
ES3.Save<GameData>("GameData", gameData, "GameData.es3");
Debug.Log("First time initialization of the GameData.es3 file");
}