Since CreateFromJSON need a class without Monobehaviour, I have 2 classes in my GO:
[System.Serializable]
public class nomre
{
public static int age;
public static nomre CreateFromJSON(string jsonString)
{
return JsonUtility.FromJson<nomre>(jsonString);
}}
and below
public class caller : MonoBehaviour {
...
string jsonity = www.downloadHandler.text;
Debug.Log("www." + jsonity);
nomre.CreateFromJSON(jsonity);
Debug.Log("age: " + nomre.age);
The debug(www) shows that the JSON object is correct and includes “age” : 20 but the debug(nomre.age) shows 0.
There’s no warning or error in my code, I just don’t get it.
Thanks for your help guru!