- Home /
Question by
zak666 · Oct 03, 2015 at 02:39 PM ·
scripting problem
error Int to string?Assets/Scripts/MyConnect.cs(61,60): error CS0029: Cannot implicitly convert type `int' to `string'
trying to imp-lement the serverside high score tutorial in my facebook game and keep running into errors. Cannot use INT in a string, yet the tutorial preforms this task try to understand it.
IEnumerator GetScores (string name, int Xp, int Lvl, int Missions, int Cash, int Gold)
{
string hash = MD5.Md5Sum(secretKey);
string Account_get = UserAccountURL + "name" + name + "Xp=" + Xp + "Lvl=" + Lvl + "Gold=" + Gold + "Cash" + Cash + Missions + hash; // return php result return values...
WWW AccountReturn = new WWW (Account_get);
yield return Account_get;
if (AccountReturn.error != null)
{
print("Unable to get User account data" + AccountReturn.error);
}
else
{
// return sores as text on game objects.........
gameObject.GetComponent<GUIText>().text = name;
gameObject.GetComponent<GUIText>().text = Gold;
gameObject.GetComponent<GUIText>().text = Cash;
gameObject.GetComponent<GUIText>().text = Xp;
gameObject.GetComponent<GUIText>().text = Lvl;
}
}
need to retern values from the server database, with users "ID" / Name to return only their values not everyones values.
Comment
Answer by hexagonius · Oct 03, 2015 at 04:08 PM
from line 15 of your code, put
ToString()
after each int you want to assign to their text variable