<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved)]]></title><description><![CDATA[<p>Hi, there's an issue, need guys to help!</p>
<p>platform: WebGL<br />
There has no exception when running in Unity Editor, but has an exception in the browser.</p>
<p>When the client joins the room, the exception shows up:</p>
<pre><code>JsonSerializationException: Unable to deserialize instance of 'Colyseus.Schema.MapSchema`1&lsqb;&lsqb;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&rsqb;&rsqb;' because there is no parameterless constructor is defined on type.
  at GameDevWare.Serialization.Metadata.TypeDescription.CreateInstance () [0x00000] in &lt;00000000000000000000000000000000&gt;: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&amp; serializerOverride) [0x00000] in &lt;00000000000000000000000000000000&gt;:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in &lt;00000000000000000000000000000000&gt;:0
</code></pre>
]]></description><link>http://discuss.colyseus.io/topic/684/can-t-run-example-from-colyseus-unity-sdk-got-jsonserializationexception-solved</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 22:41:53 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/684.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Jul 2022 20:10:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Wed, 21 Sep 2022 03:24:36 GMT]]></title><description><![CDATA[<p>Hi, there's an issue, need guys to help!</p>
<p>platform: WebGL<br />
There has no exception when running in Unity Editor, but has an exception in the browser.</p>
<p>When the client joins the room, the exception shows up:</p>
<pre><code>JsonSerializationException: Unable to deserialize instance of 'Colyseus.Schema.MapSchema`1&lsqb;&lsqb;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&rsqb;&rsqb;' because there is no parameterless constructor is defined on type.
  at GameDevWare.Serialization.Metadata.TypeDescription.CreateInstance () [0x00000] in &lt;00000000000000000000000000000000&gt;: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&amp; serializerOverride) [0x00000] in &lt;00000000000000000000000000000000&gt;:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in &lt;00000000000000000000000000000000&gt;:0
</code></pre>
]]></description><link>http://discuss.colyseus.io/post/1986</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1986</guid><dc:creator><![CDATA[wdemo]]></dc:creator><pubDate>Wed, 21 Sep 2022 03:24:36 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Wed, 03 Aug 2022 11:49:35 GMT]]></title><description><![CDATA[<p>Hi!<br />
The Unity SDK updates frequently lately.</p>
<ol>
<li>download the sdk: <a href="https://github.com/colyseus/colyseus-unity-sdk/releases/tag/0.14.18" rel="nofollow">https://github.com/colyseus/colyseus-unity-sdk/releases/tag/0.14.18</a></li>
<li>download the example: <a href="https://github.com/colyseus/colyseus-unity-sdk/tree/master/Assets/Colyseus/Runtime/Example~" rel="nofollow">https://github.com/colyseus/colyseus-unity-sdk/tree/master/Assets/Colyseus/Runtime/Example~</a></li>
<li>copy Example~ folder to unity and remove the &quot;~&quot;</li>
<li>build and run to see if all right.<br />
<img src="/assets/uploads/files/1659527369579-22233cc6-15c7-4b65-8bf1-0b8d856b0176-image-resized.png" alt="0_1659527347045_22233cc6-15c7-4b65-8bf1-0b8d856b0176-image.png" class="img-responsive img-markdown" /><br />
Good luck!</li>
</ol>
]]></description><link>http://discuss.colyseus.io/post/2017</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2017</guid><dc:creator><![CDATA[COCO]]></dc:creator><pubDate>Wed, 03 Aug 2022 11:49:35 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/873">@coco</a> ,<br />
I'm glad to see your reply.</p>
<p>But about the issue I encounter is happening in the 0.14.18 SDK.</p>
<p>I had downloaded the <a href="https://github.com/colyseus/colyseus-unity-sdk/archive/refs/tags/0.14.18.zip" rel="nofollow">https://github.com/colyseus/colyseus-unity-sdk/archive/refs/tags/0.14.18.zip</a> and used its example which is inside Assets\Colyseus\Runtime\Example~.</p>
<p>When the client joins the room(my_room, not lobby), and scene is changed to ExampleScene,  the exception shows up...</p>
<p><img src="/assets/uploads/files/1660235059753-%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2-2022-08-12-002405.png" alt="0_1660235059003_螢幕擷取畫面 2022-08-12 002405.png" class="img-responsive img-markdown" /></p>
<hr />
<p>I had traced the source code, and found that GameDevWare.Serialization may not be compatible with WebGL, iOS, and IL2CPP.<br />
For the following reasons.<br />
<img src="/assets/uploads/files/1660236252627-%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2-2022-08-12-004406.png" alt="0_1660236251809_螢幕擷取畫面 2022-08-12 004406.png" class="img-responsive img-markdown" /><br />
<img src="/assets/uploads/files/1660236261157-%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2-2022-08-12-004309-resized.png" alt="0_1660236260525_螢幕擷取畫面 2022-08-12 004309.png" class="img-responsive img-markdown" /></p>
<p>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.</p>
<p>Currently I move the code <code>if (AotRuntime || ...</code> after <code>if (defaultConstructor == null) return false;</code> to continue my test.<br />
Although it works fine, but I'm still looking forward the official update.</p>
]]></description><link>http://discuss.colyseus.io/post/2032</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2032</guid><dc:creator><![CDATA[wdemo]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p>That's true, buddy, that's true.<br />
Let me ask and see what our support says.</p>
]]></description><link>http://discuss.colyseus.io/post/2034</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2034</guid><dc:creator><![CDATA[COCO]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/2202">@wdemo</a> <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/873">@coco</a></p>
<p>Having the same issue! Thanks for posting a quick fix.</p>
]]></description><link>http://discuss.colyseus.io/post/2042</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2042</guid><dc:creator><![CDATA[gurulantern]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/2202">@wdemo</a>,</p>
<p>I'm currently trying to implement your temp solution. How do you alter your packages usually? I tried a few other solutions suggested on the internet and they don't seem to let me get through building without errors.</p>
]]></description><link>http://discuss.colyseus.io/post/2043</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2043</guid><dc:creator><![CDATA[gurulantern]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/1780">@gurulantern</a> ,</p>
<p>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.</p>
]]></description><link>http://discuss.colyseus.io/post/2046</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2046</guid><dc:creator><![CDATA[wdemo]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/2202">@wdemo</a></p>
<p>Thanks! I appreciate your response.</p>
]]></description><link>http://discuss.colyseus.io/post/2059</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2059</guid><dc:creator><![CDATA[gurulantern]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t run example from Colyseus Unity SDK, got JsonSerializationException (solved) on Invalid Date]]></title><description><![CDATA[<p>Should it have been merged into the project?</p>
<p>This was reported months ago.</p>
]]></description><link>http://discuss.colyseus.io/post/2295</link><guid isPermaLink="true">http://discuss.colyseus.io/post/2295</guid><dc:creator><![CDATA[insthync]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>