Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. wdemo
    W

    wdemo

    @wdemo

    Chat Follow Unfollow
    1
    Reputation
    3
    Posts
    232
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with wdemo
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    wdemo Follow

    Posts made by wdemo

    RE: Can't run example from Colyseus Unity SDK, got JsonSerializationException (solved)

    Hi @gurulantern ,

    I download the SDK from git instead of the package by Package Manager, and then copy Colyseus folder into the Assets folder of my project and alter the MetadataReflection.cs source code directly.

    posted in Questions & Help •
    RE: Can't run example from Colyseus Unity SDK, got JsonSerializationException (solved)

    Hi @coco ,
    I'm glad to see your reply.

    But about the issue I encounter is happening in the 0.14.18 SDK.

    I had downloaded the https://github.com/colyseus/colyseus-unity-sdk/archive/refs/tags/0.14.18.zip and used its example which is inside Assets\Colyseus\Runtime\Example~.

    When the client joins the room(my_room, not lobby), and scene is changed to ExampleScene, the exception shows up...

    0_1660235059003_螢幕擷取畫面 2022-08-12 002405.png


    I had traced the source code, and found that GameDevWare.Serialization may not be compatible with WebGL, iOS, and IL2CPP.
    For the following reasons.
    0_1660236251809_螢幕擷取畫面 2022-08-12 004406.png
    0_1660236260525_螢幕擷取畫面 2022-08-12 004309.png

    When Colyseus Unity SDK serializes message, it will never get the defaultConstructor. So it will always encounter the exception in WebGL, iOS, and IL2CPP build.

    Currently I move the code if (AotRuntime || ... after if (defaultConstructor == null) return false; to continue my test.
    Although it works fine, but I'm still looking forward the official update.

    posted in Questions & Help •
    Can't run example from Colyseus Unity SDK, got JsonSerializationException (solved)

    Hi, there's an issue, need guys to help!

    platform: WebGL
    There has no exception when running in Unity Editor, but has an exception in the browser.

    When the client joins the room, the exception shows up:

    JsonSerializationException: Unable to deserialize instance of 'Colyseus.Schema.MapSchema`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' because there is no parameterless constructor is defined on type.
      at GameDevWare.Serialization.Metadata.TypeDescription.CreateInstance () [0x00000] in <00000000000000000000000000000000>:0 
    Rethrow as SerializationException: Failed to read value for member 'attributes' of 'ExampleNetworkedUser' type.
    More detailed information in inner exception.
      at GameDevWare.Serialization.Serializers.ObjectSerializer.DeserializeMembers (GameDevWare.Serialization.IJsonReader reader, GameDevWare.Serialization.IndexedDictionary`2[KeyT,ValueT] container, GameDevWare.Serialization.Serializers.ObjectSerializer& serializerOverride) [0x00000] in <00000000000000000000000000000000>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0
    
    posted in Questions & Help •