When I call it inside a IEnumerator:
WWW www2 = OrganizeData(callParams);
Sometimes the game crashes. Here is the OrganizeData:
private WWW OrganizeData(string[] callParams)
{
string time= GetNonce().ToString();
WWWForm form = new WWWForm();
form.AddField("toTime", time);
for (int i = 0; i < callParams.Length; i += 2)
{
form.AddField(callParams[i], callParams[i + 1]);
}
Dictionary headers = form.headers;
Encoding encoding = Encoding.UTF8;
var codeTemp = encoding.GetBytes(code);
using (var hmacsha512 = new HMACSHA512(codeTemp))
{
byte[] hashmessage = hmacsha512.ComputeHash(encoding.GetBytes(callParams[1] + ":" + code+ ":" + time));
headers["Life"] = "" + ByteToString(hashmessage).ToLower();
headers["Code"] = "" + code;
headers["Content-type"] = "application/x-www-form-urlencoded";
}
byte[] rawData = form.data;
WWW www = new WWW("https:/www.gameTest/api/", rawData, headers);
return www;
}
The log shows the crash in diferent points. Sometimes here:
**WWW www2 = OrganizeData(callParams);**
And sometimes in other points:
**byte[] rawData = form.data;**
And here:
**WWW www = new WWW("https:/www.gameTest/api/", rawData, headers);**
In Unity 4 it did not happens. When the project was updated to 5, it happens always... sometimes after 30 minutes, sometimes after some hours.
Someone faced something like this?
Thanks in advance.
↧