Ejemplo n.º 1
0
    private IEnumerator UpdateCloud()
    {
        string url = HouseManager.GetBaseUrl();

        Debug.LogFormat("EventSensor.UpdateCloud: {0}", url);

        WWWForm form = new WWWForm();

        form.AddField("houseName", houseName);
        form.AddField("sensorName", sensorName);
        form.AddField("sensorData", sensorValue.ToString());
        form.AddField("sensorType", sensorType);
        using (UnityWebRequest postRequest =
                   UnityWebRequest.Post(url, form)) {
            yield return(postRequest.Send());

            if (postRequest.isError)
            {
                Debug.LogError(postRequest.error);
            }
            else
            {
                Debug.Log("EventSensor updated");
            }
        }
    }