IEnumerator Login()
{
WWWForm form = new WWWForm();
form.AddField("action", "login");
form.AddField("_nickname", Nickname_IF_Log.text);
form.AddField("_email", Email_IF_Log.text);
form.AddField("_password", Password_IF_Log.text);
using (UnityWebRequest www = UnityWebRequest.Post("http://localhost:8080/cosmicorigins/login.php", form))
{
yield return www.SendWebRequest();
if (www.result != UnityWebRequest.Result.Success)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Query Result:" + www.downloadHandler.text);
AuthResult authResult = JsonUtility.FromJson<AuthResult>(www.downloadHandler.text); (cs:271)
if (authResult.status)
{
PlayerPrefs.SetInt("ID", authResult._id);
Password_IF_Log.text = "";
Email_IF_Log.text = "";
Nickname_IF_Log.text = "";
Message_Warning_Log.text = "Login Successfully!";
ProggressBar.gameObject.SetActive(true);
StartCoroutine(LoadingCharacterCustomizedScene());
StartCoroutine(Loginsuccessfullyfalse());
}
else
{
StartCoroutine(Loginsuccessfullyfalse());
}
}
}
}
}
============================================================================
**Hello, I have the following C# code and I’m encountering a JSON parse error. I would greatly appreciate your assistance in resolving this issue. The error message is provided below:
============================================================================
ArgumentException: JSON parse error: Invalid value.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at <9022f24b5f99402395bd0f17ce2ed626>:0)
UnityEngine.JsonUtility.FromJson[T] (System.String json) (at <9022f24b5f99402395bd0f17ce2ed626>:0)
AuthManager+d__33.MoveNext () (at Assets/Scripts/AuthManager.cs:271)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <4014a86cbefb4944b2b6c9211c8fd2fc>:0)
=============================================================================
**I’ve indicated the part where the error occurs in the code within quotation marks.