- Home /
¿ Porque no me funciona el FromJSON ?
Hola, Cuando estoy convirtiendo el siguiente JSON:
{"time":["0","12.84995","15.04991","17.02488","0","9.449999","11.49997","13.57494"],"type":["1","1","1","1","1","1","1","1"],"data":["100","40.5","41","36.5\"","100","77","38.5","39\""]}
A 3 arrays en unity, De la siguiente manera:
public class Play : MonoBehaviour {
public float[] time;
public float[] type;
public float[] data;
private void Start()
{
StartCoroutine(Count());
}
IEnumerator Count()
{
yield return new WaitForSeconds(0.5f);
Convert();
}
void Convert()
{
string json = GetComponent<Text>().text;
JsonUtility.FromJson<Play>(json);
}
}
Me lanza este error:
ArgumentException: Cannot deserialize JSON to new instances of type 'Play.'
Comment