private void LoadColors(string apiType) { GUI.FocusControl(""); _colors.Clear(); var request = string.Format(COLORS_API, apiType); var www = new WWW(request); ContinuationManager.Add(() => www.isDone, () => { if (!string.IsNullOrEmpty(www.error)) { Debug.Log("WWW failed: " + www.error); } //Debug.Log(www.text); var serializer = new XmlSerializer(typeof(CLColors)); var result = serializer.Deserialize(new StringReader(www.text)) as CLColors; foreach (var c in result.Colors) { _colors.Add(new CLColorInfo(c)); } _palettes.Clear(); Refresh(); }); }
private void LoadColors(string apiType) { GUI.FocusControl(""); _colors.Clear(); var request = string.Format(COLORS_API, apiType); #if UNITY_2019_1_OR_NEWER var www = UnityEngine.Networking.UnityWebRequest.Get(request); www.SendWebRequest(); #else var www = new WWW(request); #endif ContinuationManager.Add(() => www.isDone, () => { if (!string.IsNullOrEmpty(www.error)) { Debug.Log("WWW failed: " + www.error); } //Debug.Log(www.text); var serializer = new XmlSerializer(typeof(CLColors)); #if UNITY_2019_1_OR_NEWER var result = serializer.Deserialize(new StringReader(www.downloadHandler.text)) as CLColors; #else var result = serializer.Deserialize(new StringReader(www.text)) as CLColors; #endif www.Dispose(); foreach (var c in result.Colors) { _colors.Add(new CLColorInfo(c)); } _palettes.Clear(); Refresh(); }); }