Initially i Read data from the asset this way ,
public static string ReadDataFromFile ()
{
TextAsset asset = Resources.Load ("Files/Levels") as TextAsset;
string jsonString;
jsonString = asset.text;
return jsonString;
}
and after making some changes i want to save those changes to a file so that when read i can see the changes .
public static void WriteDataToFile (string jsonString)
{
string path = Application.dataPath + "/Resources/Files/Levels.json";
Debug.Log ("AssetPath:" + path);
File.WriteAllText (path, jsonString);
#if UNITY_EDITOR
UnityEditor.AssetDatabase.Refresh ();
#endif
}
I can see the changes when run in unityEditor but when i run the code on the device the data in the file doesn’t show the changes .
I don’t know what’s wrong in this code.