In my unity project I have Resources
folder. I tried to create json file into Resources
folder. But when I run the unity it says ArgumentException:....
. I tried to use Application.dataPath
.It successfully created in unity editor...in android it is not working. The reason why I use Resources
Because I successfully read json file (which is already created) in android but I cannot create json file.
This is my simple Ciop.cs
script
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using LitJson;
public class Ciop : MonoBehaviour {
private JsonData itemData;
private baaaaza nj;
void Start () {
nj = new baaaaza("eshhak");
string jsn = Resources.Load<TextAsset>("Rr").text;
itemData = JsonMapper.ToJson(nj);
File.WriteAllText(jsn, itemData.ToString());
}
}
public class baaaaza
{
public string Name;
public baaaaza(string name)
{
this.Name = name;
}
}