SaladLab / Json.Net.Unity3D

Forked Newtonsoft.Json to support Unity3D
MIT License
918 stars 169 forks source link

WebGL error "Not implemented: Class::Il2CppTypeCompare::compare" #6

Closed bazuker closed 8 years ago

bazuker commented 8 years ago

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.

uqwrtseqrxc

Also, I rerun it but in WebGL development build and now I am getting this screenshot

veblush commented 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.

image

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.

bazuker commented 8 years ago

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?

veblush commented 8 years ago

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?

bazuker commented 8 years ago

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.

veblush commented 8 years ago

Could you make the repro project for me? I can try to find who plays with threads in your code.

bazuker commented 8 years ago

It's all good. I have already figured that out. Thanks a lot for help!

Bobby-RobertQ commented 2 years ago

what was the solution kisulken? i have the same issue running the default sdk project from playerio in unity3d 2021.2 webgl.

Stazik commented 2 years ago

solutions here: https://forum.unity.com/threads/ios-15-webgl-2-issue.1176116/ https://bugs.webkit.org/show_bug.cgi?id=237180