UNITY WEBGL Always Fail with 0.14

0_1600346515458_8cf4b02b-c84a-4051-921a-0c3bb5c55ae1-image.png

I create an whole new Project with Colyseus 0.14 use Schema, and Unity 3D use 0.14 plugin.
The clean build of WEBGL always return memory access out of bound :(
Is there any solutions for this ?

0_1600357762621_40f3a028-d3f6-488e-a706-15e28f346c3b-image.png

71mb for ArrayBufferData in empty schema
Its really a big deal :(

Hi @kai_nguyenhuu,

I just checked and indeed WebGL builds are not working yet on version colyseus-unity3d 0.14 (alpha). In the example project from the repo, it crashes immediatelly after joining a room:

0_1600359045461_Screen Shot 2020-09-17 at 13.10.19.png

(I need to check why this error is happening on WebGL!)

Not sure how you managed to get past this error - are you sure you're using the 0.14 alpha version in the client-side?

71mb for ArrayBufferData in empty schema

This is related to Unity WebGL / emscriptten (has nothing to do with your empty schema). Indeed Unity WebGL builds are a disaster I can't do anything about. I've heard Unity Tiny is supposed to be much better in this regard - I haven't tried it personally, though.

@endel said in UNITY WEBGL Always Fail with 0.14:

Indeed Unity WebGL builds are a disaster I can't do anything about.

Thank you for your reply
I am using 0.14 alpha and build Development Version for displaying errors and I see this out of bound memory, you can try these settings.
here is the full log:

e6296834-adc2-4891-bead-9fec51d1e47d:16501 Uncaught RuntimeError: memory access out of bounds
    at __ZN16VirtFuncInvoker0IP6Type_tE6InvokeEjP12Il2CppObject (<anonymous>:wasm-function[14275]:0x49f68f)
    at _LightLambda_MakeRunDelegateCtor_m34176183E3A928A397721E889331C32DF9C556C1 (<anonymous>:wasm-function[29012]:0x6ff302)
    at dynCall_iii (<anonymous>:wasm-function[38913]:0x8a8460)
    at Object.dynCall_iii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:23532:38)
    at invoke_iii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:15478:31)
    at _LightLambda_GetRunDelegateCtor_m802F474EE5F98CB221B2E24609A743536CFF4517 (<anonymous>:wasm-function[29010]:0x6fe6f9)
    at _LightLambda_MakeDelegate_m5BF4647527466A602E0339000CBE3382BB98B4C0 (<anonymous>:wasm-function[29009]:0x6fe518)
    at _LightDelegateCreator_CreateDelegate_mAD897B269ED0186D1E2CEA54BFBD550375E072F6 (<anonymous>:wasm-function[29007]:0x6fe4aa)
    at _LightDelegateCreator_CreateDelegate_m1B6E2A2E3D20D75EB586A04B9F248208272329CC (<anonymous>:wasm-function[29006]:0x6fe459)
    at _Expression_1_Compile_m5F2BD4EE3DA1F051DDD2D1CF6B3467390FE06A39_gshared (<anonymous>:wasm-function[32776]:0x7a1b61)
    at _Expression_1_Compile_mFE50C0A6E0A4094C260C663865AE2998F8D3EC9C_gshared (<anonymous>:wasm-function[32775]:0x7a1b17)
    at _CallSite_1_CreateCustomNoMatchDelegate_m6BCC989CF45D9202768E2EBB6CA15472929099AB_gshared (<anonymous>:wasm-function[30404]:0x72d768)
    at _CallSite_1_MakeUpdateDelegate_mA3D780010BF746743A550D06DA68B526AFC2A149_gshared (<anonymous>:wasm-function[30401]:0x72c6b5)
    at _CallSite_1_GetUpdateDelegate_m79CA328C2441772AC6F7F926AABEE80EB325C34E_gshared (<anonymous>:wasm-function[30398]:0x72c4ef)
    at _CallSite_1_GetUpdateDelegate_m075943FBD03182D985E9B8AD853B54A93ABA7BB9_gshared (<anonymous>:wasm-function[30397]:0x72c4c1)
    at _CallSite_1__ctor_m016244378ECCDAD6C12C5EC311197593644F1AC9_gshared (<anonymous>:wasm-function[30393]:0x72c2f0)
    at _CallSite_1_Create_m8BA8F1719AEF3E1526C60C38C28E5F6F76B3D999_gshared (<anonymous>:wasm-function[30396]:0x72c460)
    at __Z59CallSite_1_Create_mCEA53BA1AA06CD5A94B6449183437E1FEF57C227P56CallSiteBinder_t76CF754DF48E3820B386E9C71F8DA13FCDD1C889PK10MethodInfo (<anonymous>:wasm-function[16971]:0x50b390)
    at _Schema_set_Item_m9192F2FB40E7BBE7186D57186BCE707E0FE74B61 (<anonymous>:wasm-function[16992]:0x50ba29)
    at _Schema_Decode_mED0B69A23A445801376C5C7F8753354B5A0C8621 (<anonymous>:wasm-function[16994]:0x50c5c5)
    at _SchemaSerializer_1_Handshake_m16C78A6FED561D75AF0BF3059425DD045953D6EE_gshared (<anonymous>:wasm-function[25201]:0x6682ec)
    at __ZN23InterfaceActionInvoker2IP12Il2CppObjectS1_E6InvokeEjP11Il2CppClassS1_S1_S1_ (<anonymous>:wasm-function[16556]:0x4f501a)
    at dynCall_viiiii (<anonymous>:wasm-function[39016]:0x8a8f11)
    at Object.dynCall_viiiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24047:41)
    at invoke_viiiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:16508:27)
    at _U3CParseMessageU3Ed__37_MoveNext_m961408E7C092E417F72BF3DDE3409B849D3FED26_gshared (<anonymous>:wasm-function[25082]:0x661e49)
    at __ZN23InterfaceActionInvoker06InvokeEjP11Il2CppClassP12Il2CppObject (<anonymous>:wasm-function[14281]:0x49fa38)
    at dynCall_viii (<anonymous>:wasm-function[39012]:0x8a8eaf)
    at Object.dynCall_viii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24027:39)
    at invoke_viii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:16468:25)
    at _AsyncVoidMethodBuilder_Start_TisRuntimeObject_m8590BDB280C38FD9D41163DF39805FFA6EA8F508_gshared (<anonymous>:wasm-function[20974]:0x597c73)
    at __Z139AsyncVoidMethodBuilder_Start_TisU3CParseMessageU3Ed__37_tD1CFFCBA0DEE11C960CC79E46042EA00C0374AB2_m49937871A6FFD69FA0DD71EEC151C468CF0E6E50P64AsyncVoidMethodBuilder_t44E3C9B52B019BB5BDCC0E1BB83188B536161CFFPP65U3CParseMessageU3Ed__37_tD1CFFCBA0DEE11C960CC79E46042EA00C0374AB2PK10MethodInfo (<anonymous>:wasm-function[25122]:0x665174)
    at _Room_1_ParseMessage_m652746ACA553F31780383C8DBC1D3D6CFB594C95_gshared (<anonymous>:wasm-function[25119]:0x665120)
    at _Room_1_U3CSetConnectionU3Eb__25_2_m32611B5D6169915CABD3BC495839932E92702EF8_gshared (<anonymous>:wasm-function[25127]:0x6652c1)
    at _OnChangeEventHandler_Invoke_m03FBDEEBF2D4821CC9EA1180A8CB8606CC0DE738 (<anonymous>:wasm-function[16958]:0x50a90b)
    at _WebSocket_DelegateOnMessageEvent_mF14DAEE5729B03D82FAB1C330E25C2AB445DB6CB (<anonymous>:wasm-function[22958]:0x5f6c90)
    at _WebSocketFactory_DelegateOnMessageEvent_m557BCF08A8C8CD3E0BE9FE4517E13B5E14162D83 (<anonymous>:wasm-function[22969]:0x5f710a)
    at dynCall_viiii (<anonymous>:wasm-function[39015]:0x8a8ef6)
    at Object.dynCall_viiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24042:40)
    at invoke_viiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:16498:26)
    at _ReversePInvokeWrapper_WebSocketFactory_DelegateOnMessageEvent_m557BCF08A8C8CD3E0BE9FE4517E13B5E14162D83 (<anonymous>:wasm-function[22968]:0x5f700c)
    at dynCall_viii (<anonymous>:wasm-function[39012]:0x8a8eaf)
    at blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24027:39
    at Object.dynCall (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:366:35)
    at WebSocket.<anonymous> (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:3685:13)

about the bufffer, I will try not to connect to the room and check the heap memory again :D

btw, every still good in 0.13 version, except the map schema ^_^ 0.14 every thing work ok on vuejs but fail in WEBGL now :(

Oh, I see! Thanks for pointing out the development flag, lol!
Maybe it would be better if you continue with 0.13 for now, and avoid using numbers as keys for MapSchema. I'll let you know when this problem on WebGL is fixed! Thanks for trying out! 🙏

@endel Wait, you mean type string with value "123456" as a key of MapSchema is a number ??? Really @@
So what about "P123456" :-? is this string ?

Hi @kai_nguyenhuu, sorry for the delay to answer you here.

So what about "P123456" :-? is this string ?

Yes, this should do on 0.13. It is a string, not a digit/number.

I've spent some time today to fix the issue you mentioned in the first place ("Uncaught RuntimeError: memory access out of bounds"). It turns out the problem was using the C# dynamic keyword. This keyword is not supported on Unity WebGL builds.

You can download the latest version (0.14.0-alpha.2) here https://github.com/colyseus/colyseus-unity3d/releases

Thank you, I will check it out