I've been trying to make a register function for a database and have run into an issue with using WWW where I'm told its obsolete and to use UnityWebRequest, however when I switch WWW with UnityWebRequest other issues arise, does anyone know what I could do to fix this?
Here is the code:
IEnumerator Register()
{
WWWForm form = new WWWForm();
form.AddField("name", regUsernameField.text);
form.AddField("password", regPasswordField.text);
WWW www = new WWW("http://localhost/sqlconnect/register.php", form);
yield return www;
if (www.text == "0")
{
Debug.Log("User created successfully");
UnityEngine.SceneManagement.SceneManager.LoadScene("StartMenu");
}
else
{
Debug.Log("User creation failed. Error #" + www.text);
}
}
↧