Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by unity_3ARvOdIC_n98JA · Feb 18, 2019 at 10:58 AM · webglnot workingjson

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;
 }
   

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

109 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges