- Home /
json webGL no work Unity 2018.3.3f1
Hola He hecho un proyecto en donde conecto json con unty va correctamente , el problema es cuando exporto a webGL ignora todo la parte del código de json. ¿Por qué? Gracias por vuestro tiempo pongo el código abajo.
Hi I connect json and unity in a project that work correct , but when I export to webGL it stop to work what happen?. Thanks for your time, I put the code down.
using System.IO; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class json_text : MonoBehaviour { // guardamos todo el json en una variable string; public string json;
 jsonDAts loadedjsonDAts;
 public int jsonnumber;
   
 public Text Pantalla, Pantalla2;
 // Start is called before the first frame update
 void Start()
 {
     // guardamos todo el json en una variable string;
     json = File.ReadAllText(Application.dataPath + "/StreamingAssets/Urls.json");
     // guarda en una varable tipo la clase con datos de jon todos los datos del json
     loadedjsonDAts = JsonUtility.FromJson<jsonDAts>(json);
     //cambiamos el valor de name por una variavle de tipo int
     jsonnumber = loadedjsonDAts.Numero;
 }
 // Update is called once per frame
 void Update()
 {
     // notificaciones visuales 
     Debug.Log(json);
     Pantalla.text = json;
     Pantalla2.text = loadedjsonDAts.Numero.ToString();
     // guarda en una varable tipo la clase con datos de jon todos los datos del json
    
 }
 public void sobreEscribirDatos()
 {
     //loadedjsonDAts.ToString = json;
     //string lalalr = "lalalal";
     //crea un archivo json si ya existia lo sobrescribe y le pone el texto del json
     json = loadedjsonDAts.ToString();
     File.WriteAllText(Application.dataPath + "/StreamingAssets/escritura.json", json);
     loadedjsonDAts = JsonUtility.FromJson<jsonDAts>(json);
 }
 public void Cambiarstring(int cambio)
 {
     //cambia el valor del nombre de la clase jsonDats
     loadedjsonDAts.Numero = cambio;
     Debug.Log(loadedjsonDAts.Numero);
 }
 // creamos una clase dentro de otra clase que guaradara los datos del json
 [SerializeField]
 public class jsonDAts
 {
     public int Numero;
 }
   
}
Your answer
 
 
             Follow this Question
Related Questions
Reading .json file from WebGL build 0 Answers
Is there any limitations to deserializing json on webgl? 0 Answers
WebGL Redirect 0 Answers
WebGL embed in asp.net mvc 2 Answers
How To Separate Json Parameter Function to get values i need ? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                