【发布时间】:2019-09-17 04:16:50
【问题描述】:
我正在尝试设置我的帐户注册系统以将数据从统一输入到我的数据库,到目前为止,我已经能够通过 Inspector 做到这一点,现在我希望能够使用我的 UI 来做到这一点我在 Unity 中制作,我需要做什么? (P.S.这是我第一次发帖,我也是初学者,如果我可能不遵守一些规则,请原谅)
这是我用来通过 Unity 中的检查器将数据输入到我的 PhpMyAdmin 数据库的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DataInserter : MonoBehaviour
{
public GameObject inputUserName;
public GameObject inputEmail;
string CreateUserURL = "http://localhost/balikaral/insertAccount.php";
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space)) CreateUser(inputUserName, inputEmail);
}
public void CreateUser(string username, string email)
{
WWWForm form = new WWWForm();
form.AddField("usernamePost", username);
form.AddField("emailPost", email);
WWW www = new WWW(CreateUserURL, form);
}
}
【问题讨论】:
标签: c# mysql database unity3d account