I am using the WWW class and using it to get score from getScore.php… It works but when i built it and run on the web player it won’t work.
I checked using"Inspect Element" and actually it called http://company.com/game/company.com/game/getScore.php when I need it to call http://company.com/game/getScore.php
The address from the address bar is added in front of the url that I wanted to call.Does anybody know the reason for this to happen?
This is the code I’m using.
using UnityEngine;
using System.Collections;
public class score : MonoBehaviour {
public GUIText scoreText;
string theURLis = "http://company.com/game/getScore.php";
// Use this for initialization
void Start () {
StartCoroutine ("getScore");
}
void OnGUI () {
if (GUI.Button (new Rect (600, 400, 50, 30), "back"))
back ();
}
void back() {
Application.LoadLevel ("menu");
}
IEnumerator getScore() {
WWW getScoreText = new WWW (theURLis);
yield return getScoreText;
scoreText.text = getScoreText.text;
}
}