private IEnumerator CreateSprites(string _skinID) { var form = new WWWForm(); form.AddField("id", _skinID); using (var www = UnityWebRequest.Post(Constants.WebServer + "retrieveskinimage.php", form)) { yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { var bytes = www.downloadHandler.data; var texture = new Texture2D(2, 2); texture.LoadImage(bytes); var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); Skins.PopulateSkinImage(sprite); _imageRetrieved = true; } } }