using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using System.Text.RegularExpressions; public class php : MonoBehaviour { string url = "http://localhost/unity/addscore.php"; // Start is called before the first frame update void Start() { //int score = ArrowController.eat_arrow; int score = 99; StartCoroutine(submit_highscore("Unity+PHP",score)); Debug.Log(score); } public void update_score() { //int score = ArrowController.eat_arrow; //StartCoroutine(submit_highscore("Unity+PHP",score)); //Debug.Log(score); } IEnumerator submit_highscore(string player_name, int player_score) { WWWForm form = new WWWForm(); form.AddField("action","submit_highscore"); form.AddField("name",player_name); form.AddField("score",player_score); WWW www = new WWW(url,form); yield return www; if (!string.IsNullOrEmpty(www.error)) { Debug.Log(www.error); } Debug.Log(www.text); } // Update is called once per frame void Update() { } }