using UnityEngine; using System.Collections; public class testscript : MonoBehaviour { public GameObject target; // このオブジェクトに張り付いているTextureを取得します。 public string url;// 仮に "http://example.com/upload/" と入ります private byte[] dataBytes; void Start() { StartCoroutine(Post()); } IEnumerator Post() { WWWForm form = new WWWForm(); Texture2D img = (Texture2D)target.GetComponent<Renderer> ().material.mainTexture; dataBytes = img.EncodeToPNG(); form.AddBinaryData("foo", dataBytes, "foo.png", "image/png"); WWW www = new WWW(url, form); yield return www; if (www.error != null) { Debug.Log(www.error); } else { Debug.Log("Finished"); } } }
デバッグログに
404 Not Found
と出ます。これってダウンロードしようとしているからなのでしょうか・・?
何かスクリプト以外にも原因になりうる箇所、もしくはスクリプトで問題がありましたら、
ご教授頂けると幸いです。
「url」が指すサーバ側は、どのようになっていますか?
あなたの回答
tips
プレビュー