My unity game uses a WWW to POST data to a php server. When I run the game from the editor all fine. However, when I run the webgl build my server is getting blank data. Why? I'm using unity 5.1.2f1.
1) Dictionary header = new Dictionary(); header.Add("Access-Control-Allow-Credentials", "true"); header.Add("Access-Control-Allow-Headers", "Accept"); header.Add("Access-Control-Allow-Methods", "POST"); header.Add("Access-Control-Allow-Origin", "*");
WWW www = new WWW(_serverURL, data, header);
2) WWWForm form = new WWWForm(); form.headers.Add("Access-Control-Allow-Credentials", "true"); form.headers.Add("Access-Control-Allow-Headers", "X-Requested-With"); form.headers.Add("Access-Control-Allow-Headers", "Content-Type"); form.headers.Add("Access-Control-Allow-Methods", "POST"); form.headers.Add("Access-Control-Allow-Origin", "*"); form.AddBinaryData("data", data);
WWW www = new WWW(_serverURL, form);
Any ideas?
Aucun commentaire:
Enregistrer un commentaire