Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void LightColor(string newColorHue)
- {
- string lightApiNumber = PlayerPrefs.GetString("lightapinumber");
- string onBodyCommandColorHue = "{\"hue\": " + newColorHue +",\"bri\": 254, \"sat\": 254}";
- StartCoroutine(ChangeColor());
- IEnumerator ChangeColor()
- {
- byte[] myData = System.Text.Encoding.UTF8.GetBytes(onBodyCommandColorHue);
- Debug.Log("Dentro de LightColor esta llegando el color: "+newColorHue);
- using (UnityWebRequest www = UnityWebRequest.Put("http://" + PlayerPrefs.GetString("bridgeip") + "/api/" + PlayerPrefs.GetString("username") + "/lights/" + lightApiNumber + "/state", myData))
- {
- yield return www.Send();
- if (www.isNetworkError || www.isHttpError)
- {
- Debug.Log(www.error);
- }
- else
- {
- Debug.Log("completado");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement