Пример #1
0
    private IEnumerator GetSteps()
    {
        UnityWebRequest www = UnityWebRequest.Get(
            "http://hunction2018.herokuapp.com/products");

        yield return(www.SendWebRequest());

        if (www.isNetworkError)
        {
            Debug.Log("Network error: " + www.error);
        }
        if (www.isHttpError)
        {
            Debug.Log("Http error: " + www.error);
        }

        string sJason = www.downloadHandler.text;

        Debug.Log("List " + sJason);
        var tempSteps = PlayerTracker.getJsonArray <Step>(sJason);

        if (tempSteps != null)
        {
            Debug.Log("Got " + tempSteps.Length + " steps");
            steps          = tempSteps;
            currentStepIdx = 0;
        }
        else
        {
            Debug.Log("tempSteps is null");
        }
    }