Reputation: 440
I read this article and try it.
I wrote a very simple code to read the json file:
void Start()
{
Debug.Log(evolution.text);
try
{
EvolutionDic = JsonUtility.FromJson<Dictionary<string, string>>(evolution.text);
}
catch(Exception e)
{
Debug.Log(e.Message);
}
Debug.Log(EvolutionDic.Count);
}
The code read the evolution.text
correctly, but didn't write into the dictionary.
I had tested the Json file in Visual C# and have no problem reading it into the dictionary.
Could somebody please be so kind and tell me where did I do wrong!?
Much appreciated!
Upvotes: 0
Views: 105
Reputation: 4283
Dictionaries aren't natively serializable/deserializable.
Upvotes: 1