C# 从Unity3D Android游戏将分数保存到MS SQL数据库
我正在尝试将分数保存到MS SQL数据库中 我创建了ASP.NET MVC web应用程序,当我尝试调用特定URL时: www.mydomain.com/controller/action whit特定参数: name=somename&score=somescore 分数将被保存 在unity C脚本中,我使用了WWWAPI。以下是代码:C# 从Unity3D Android游戏将分数保存到MS SQL数据库,c#,android,sql-server,asp.net-mvc-4,unity3d,C#,Android,Sql Server,Asp.net Mvc 4,Unity3d,我正在尝试将分数保存到MS SQL数据库中 我创建了ASP.NET MVC web应用程序,当我尝试调用特定URL时: www.mydomain.com/controller/action whit特定参数: name=somename&score=somescore 分数将被保存 在unity C脚本中,我使用了WWWAPI。以下是代码: using UnityEngine; using System.Collections; public class ShowScore : MonoBeh
using UnityEngine;
using System.Collections;
public class ShowScore : MonoBehaviour {
public string addScoreURL = "http://www.mydomain.com/controller/action?";
string score=SomeStaticClass.Score;
void Start ()
{
string name=SystemInfo.deviceName+"_"+SystemInfo.deviceModel;
StartCoroutine(PostScores(name,score));
}
IEnumerator PostScores(string name, int score)
{
string post_url = addScoreURL + "name=" + WWW.EscapeURL(name) + "&score=" + score ;
WWW hs_post = new WWW(post_url);
yield return hs_post; // Wait until the download is done
if (hs_post.error != null)
{
print("There was an error posting the high score: " + hs_post.error.ToUpper());
}
}
为了进行测试,我为windows、web和android构建了应用程序。在windows和web上一切正常,但android应用程序并没有将分数保存到数据库中
有什么问题吗?回答有点晚,但使用它可能会影响您的数据库速度使用android时,您是否检查了请求是否达到mvc操作?如果是这样的话,它看起来正确吗?我认为这个请求是正确的,因为它从PC和Web上达到了mvc操作,并且android的代码没有变化。谢谢你的回答。我退出了MSSQL,将所有内容都放在MySql上。