IEnumerator LogInAccount(string uName, string pWord)
    {
        WWWForm form = new WWWForm();

        form.AddField("loginUsername", uName);
        form.AddField("loginPassword", pWord);
        using (UnityRequest www = UnityWebRequest.Post("http://localhost:8080/Unity/", form))
        {
            www.downloadHandler = new DownloadHandlerBuffer();
            yield return(www.SendWebRequest());

            if (www.isNetworkError)
            {
                Debug.Log(www.error);
            }
            else
            {
                string responseText = www.downloadHandler.text;
                Debug.Log("Response Text from the server = " + responseText);
                info.text = "Response Text from the server " + responseText;
            }
        }
    }
Exemple #2
0
 /// <summary>
 /// Begin communicating with the remote server.
 /// </summary>
 /// <param name="callback">Communication callback.</param>
 public void Send(Action <UnityWebRequest> callback)
 {
     m_OnComplete              = callback;
     EditorApplication.update += OnEditorUpdate;
     UnityRequest.SendWebRequest();
 }