Closed bazuker closed 8 years ago
It seems that there is something in WebGL implementation of Unity. And following scheme classes are generated from json file by json2csharp.
public class Map
{
public int ID { get; set; }
public int TID { get; set; }
public double Angle { get; set; }
public bool IsWalkable { get; set; }
public bool IsShootable { get; set; }
}
public class Object
{
public string Tag { get; set; }
public bool IsCircleCollider { get; set; }
public bool HasCollider { get; set; }
public bool IsSprite { get; set; }
public double X { get; set; }
public double Y { get; set; }
public double Z { get; set; }
public double Scale { get; set; }
public object gameObject { get; set; }
public int ID { get; set; }
public int TID { get; set; }
public double Angle { get; set; }
public bool IsWalkable { get; set; }
public bool IsShootable { get; set; }
}
public class Collider
{
public int x0 { get; set; }
public int x1 { get; set; }
public int y0 { get; set; }
public int y1 { get; set; }
}
public class RootObject
{
public int Width { get; set; }
public int Height { get; set; }
public List<Map> Map { get; set; }
public List<Object> Objects { get; set; }
public List<Collider> Colliders { get; set; }
}
Following code deserializes json file into c# object and seems to work well.
private void LoadData()
{
WriteLine("* LoadMap");
var json = Resources.Load("map") as TextAsset;
var root = JsonConvert.DeserializeObject<RootObject>(json.text);
WriteLine("Width: " + root.Width);
WriteLine("Height: " + root.Height);
WriteLine("#Map: " + root.Map.Count);
WriteLine("#Objects: " + root.Objects.Count);
WriteLine("#Colliders: " + root.Colliders.Count);
}
Following screenshot is created under Unity 5.3.5f1 and MS Edge 25.
Please tell me differences between mine and yours and I think it may have WebGL & Il2CPP related issues and it helps if you report this issue to Unity too.
It actually works well. I have checked it twice and found out that am getting this error after the map was deserialized. Now I am really having a problem with figuring out what is happening. Do you really think it might be an internal problem of WebGL & Il2CPP?
Json.NET doesn't anythiing (as far as i know) after (de)serialization something so this error could be thought of as being caused by something else. From error callstack, your code uses thread-related features and it throws exception because WebGL doesn't support thread. Reference. Is there anything about thread in your code?
I think I do not use "pure" threads. The only thing I use for multithreading is unity's coroutines. I am not sure how they works under the knife.
Could you make the repro project for me? I can try to find who plays with threads in your code.
It's all good. I have already figured that out. Thanks a lot for help!
what was the solution kisulken? i have the same issue running the default sdk project from playerio in unity3d 2021.2 webgl.
After a try to deserialize the json (map.zip) in WebGL(release build), my browser freezes and the console log literally blows up with the messages shown on the screenshot.
Also, I rerun it but in WebGL development build and now I am getting this![screenshot](https://cloud.githubusercontent.com/assets/7709243/16521857/6cc4788c-3fa2-11e6-8b62-22a336f26048.jpg)