NewWorkManager whith phpmyadmin

El error es el siguiente Error:
ArgumentException: JSON parse error: Invalid value.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at C:/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:42)
UnityEngine.JsonUtility.FromJson[T] (System.String json) (at C:/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:30)
NetWorkManager+<CD_CrearUsuario>d__1.MoveNext () (at Assets/InicioDeSesion/NetWorkManager.cs:25)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)

Pero el error me redirige la linea 25.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.Networking;
using System.IO;

public class NetWorkManager : MonoBehaviour
{
    public void CrearUsuario(string userName, string email, string password, Action<Response> response)
    {
        StartCoroutine(CD_CrearUsuario (userName, email, password, response));
    }

    private IEnumerator CD_CrearUsuario(string userName, string email, string password, Action<Response> response)
    {
        WWWForm form = new WWWForm();
        form.AddField("Usuario", userName);
        form.AddField("Correo", email);
        form.AddField("Contraseña", password);

        WWW w = new WWW("http://localhost/DatosGradoDeLibertad/CrearUsuarios.php", form);
        yield return w;

        Response respons = JsonUtility.FromJson<Response>(w.text);
    }
}

[Serializable]
    public class Response
    {
        public bool Done = false;
        public string Mensaje = "";
    }

Well, is w.text valid JSON? Because it is just telling you it is not. If that is the case, the issue is likely in your PHP rather than your Unity code. You haven’t posted the contents of w.text, so I’m going to assume the error message is correct.

1 Like