i was going through an old tutorial showing how to use unity and php to link to an sql database and then i went into unity and it said WWW is obselete and i can’t get it to work with webrequest. i am making a script so people can register and i am not sure how to use webrequest and wwwform together
here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class Register : MonoBehaviour
{
public InputField NameInput;
public InputField EmailInput;
public InputField PasswordInput;
void CallRegister()
{
StartCoroutine(RegisterAccount());
}
IEnumerator RegisterAccount()
{
WWWForm form = new WWWForm();
form.AddField("name", NameInput.text);
form.AddField("email", EmailInput.text);
form.AddField("password", PasswordInput.text);
using (UnityWebRequest www = UnityWebRequest.Get("http://localhost/sqlconnect/register.php", form))
{
yield return www.Send();
Debug.Log(www.downloadHandler.text);
}
}
}