Unity WebGL issue

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Francis Bacon
Posts: 2
Joined: 25 Apr 2017, 01:24

Unity WebGL issue

Postby Francis Bacon » 25 Apr 2017, 09:07

Hi. I have an error when try open webgl build in browser. It appear when call sfs.Connect(cfg);
I try Connector example and errors is same. If build with "Use pre-built Engine" in browser console:

Code: Select all

writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!  UnityLoader.js:234:40
   printErr file:///Users/username/Downloads/SFS2X_Unity5_Examples/01%20Connector/source/Connector/build/Build/UnityLoader.js:234:40
   warnOnce blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:609:4
   writeStringToMemory blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:1359:2
   _SocketError blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:4204:2
   _WebSocketHelper_SocketError_m1925103104 blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1692882:1
   _WebSocketHelper_get_Error_m876684277 blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1479851:1
   _WebSocketLayer_ProcessState_m28010108 blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:790759:1
   _SmartFox_ProcessEvents_m4122726183 blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:995328:1
   _Connector_Update_m3645913861 blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1758793:1
   __Z31RuntimeInvoker_Void_t1841601450PK10MethodInfoPvPS2_ blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1752812:1
   dynCall_iiii blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1764174:1
   invoke_iiii blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:16457:10
   __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1481170:1
   _il2cpp_runtime_invoke blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1676258:1
   __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1563192:1
   __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1032580:1
   __ZN13MonoBehaviour16CallUpdateMethodEi blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:895049:1
   __ZN13MonoBehaviour6UpdateEv blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1792777:1
   __ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:833089:1
   __ZN16BehaviourManager6UpdateEv blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1552433:1
   __ZZ23InitPlayerLoopCallbacksvEN36UpdateScriptRunBehaviourUpdatestruct7ForwardEv blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1732130:1
   __Z10PlayerLoopv blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:444863:1
   __ZL8MainLoopv blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1178790:1
   dynCall_v blob:null/8619d6ac-267b-8646-baec-98dfd4c863a9:1805649:1
   browserIterationFunc blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2385:4
   runIter blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2487:5
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2423:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3
   (Async: FrameRequestCallback)
   requestAnimationFrame blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2777:4
   Browser_mainLoop_scheduler_rAF blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:3043:4
   Browser_mainLoop_runner blob:null/89ef0a89-33f3-614b-a2bf-620439f0e069:2427:3


If "Use pre-built Engine" unchecked i see next error:

Code: Select all

exception thrown: ReferenceError: webSocketInstances is not defined,SocketCreate@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542:103:7
_SocketCreate@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542 line 844 > eval:2666:10
_WebSocketHelper_SocketCreate_m3460154046@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542 line 844 > eval:674272:7
_WebSocketHelper_Connect_m3882593687@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542 line 844 > eval:537491:25
_WebSocketLayer_Connect_m3001310401@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542 line 844 > eval:286809:3
mftCall_viiii@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542 line 844 > eval:670812:3
__ZN23InterfaceActionInvoker2IP8String_tiE6InvokeEjP11Il2CppClassP12Il2CppObjectS1_i@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf9584542 line 844 > eval:384431:2
_WebSocketClient_Connect_m2697384757@blob:http://site.com/00522cbd-92cd-b74a-a856-d17cf95[…]  UnityLoader.js:234:40
Invoking error handler due to
ReferenceError: webSocketInstances is not defined


Unity 5.6.0.p2 open in Safari, Chrome, Firefox
User avatar
Bax
Site Admin
Posts: 4390
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity WebGL issue

Postby Bax » 26 Apr 2017, 15:51

If this is confirmed, then Unity has changed something in the latest version.
We will investigate and let you know what we discover.
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4390
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity WebGL issue

Postby Bax » 27 Apr 2017, 10:39

About the "writeStringToMemory is deprecated" message, this is just a warning and doesn't prevent the connection to be established and work as expected. In any case, if you want to get rid of it, open the SFSWebSockets.jslib file provided with the C# API's DLL for WebGL, go to line 108 and change the call to writeStringToMemory with the following:

Code: Select all

stringToUTF8(returnStr, buffer, returnStr.length + 1);

Disclaimer: we haven't tested this change with previous Unity versions, so we recommend to do it if you are using Unity 5.6+ only.

About the "ReferenceError: webSocketInstances is not defined" error, we have no clue on the reason why enabling the usage of pre-built engine causes it. This seems to be something related to Unity, asm.js and Emscripten, so we have no control over it. We recommend disabling that option for the time being.
Paolo Bax
The SmartFoxServer Team
Francis Bacon
Posts: 2
Joined: 25 Apr 2017, 01:24

Re: Unity WebGL issue

Postby Francis Bacon » 03 May 2017, 16:06

Thank you for your answer. If unchecked "Development build" then works good.

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 1 guest