Hi, I have a project based on the Tris Unity example and it is building fine for standalone and Android, but when I build for WebGL, it's giving me this error:
Any ideas?
Assets\Scripts\SmartFoxConnection.cs(13,19): error CS0433: The type 'SmartFox' exists in both 'SmartFox2X, Version=1.7.9.0, Culture=neutral, PublicKeyToken=null' and 'SmartFox2X_WebGL, Version=1.7.9.0, Culture=neutral, PublicKeyToken=null'
The type 'SmartFox' exists in both
Re: The type 'SmartFox' exists in both
It seems you selected the wrong platforms to associate the WebGL API to in the Inspector panel when clicking on the DLL.
Please make sure you follow the instructions on this page: http://docs2x.smartfoxserver.com/Gettin ... harp#unity
Please make sure you follow the instructions on this page: http://docs2x.smartfoxserver.com/Gettin ... harp#unity
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: The type 'SmartFox' exists in both
ah, I missed that!
But now I am getting this error and I can't build even for Windows nor Android
I kept reimporting and checking/unchecking boxes in SmartFox2X_UWP and SmartFox2X_WebGL and still it cannot recognise 'Sfs2x'
But now I am getting this error and I can't build even for Windows nor Android
Code: Select all
Assets\Scripts\GameController.cs(8,7): error CS0246: The type or namespace name 'Sfs2X' could not be found (are you missing a using directive or an assembly reference?)
I kept reimporting and checking/unchecking boxes in SmartFox2X_UWP and SmartFox2X_WebGL and still it cannot recognise 'Sfs2x'
Re: The type 'SmartFox' exists in both
Select all three DLLs we provide in our API package, one by one:
- for SmartFox2X.dll, check everything except WebGL and WSAPlayer (Universal Windows Platform) --- SEE PICTURE BELOW;
- for SmartFox2X_WebGL.dll, only check WebGL;
- for SmartFox2X_UWP.dll (if you use it), only check WSAPlayer.
That should work.
- for SmartFox2X.dll, check everything except WebGL and WSAPlayer (Universal Windows Platform) --- SEE PICTURE BELOW;
- for SmartFox2X_WebGL.dll, only check WebGL;
- for SmartFox2X_UWP.dll (if you use it), only check WSAPlayer.
That should work.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: The type 'SmartFox' exists in both
Thank you, I am able to build in WebGL now. But it is not able to connect to the server from the browser (it says
And when it runs from Unity, it gives this error
When I switch my build back to Windows or Android, it runs fine
Code: Select all
"Connection failed; is the server running at all?"
And when it runs from Unity, it gives this error
Code: Select all
InvalidOperationException: The current state of the connection is not Open.
WebSocketSharp.WebSocket.SendAsync (System.Byte[] data, System.Action`1[T] completed) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.Sockets.WebSocketHelper.Send (System.Byte[] buffer) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.Sockets.WebSocketLayer.Write (System.Byte[] data) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.WSIOHandler.WriteBinaryData (Sfs2X.Core.PacketHeader header, Sfs2X.Util.ByteArray binData) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.WSIOHandler.OnDataWrite (Sfs2X.Bitswarm.IMessage message) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.WSProtocolCodec.OnPacketWrite (Sfs2X.Bitswarm.IMessage message) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Bitswarm.WebSocketClient.Send (Sfs2X.Bitswarm.IMessage message) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.Send (Sfs2X.Requests.IRequest request) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.SendHandshakeRequest (System.Boolean isReconnection) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.OnSocketConnect (Sfs2X.Core.BaseEvent e) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Rethrow as Exception: Error dispatching event connect: The current state of the connection is not Open. at WebSocketSharp.WebSocket.SendAsync (System.Byte[] data, System.Action`1[T] completed) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.Sockets.WebSocketHelper.Send (System.Byte[] buffer) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.Sockets.WebSocketLayer.Write (System.Byte[] data) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.WSIOHandler.WriteBinaryData (Sfs2X.Core.PacketHeader header, Sfs2X.Util.ByteArray binData) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.WSIOHandler.OnDataWrite (Sfs2X.Bitswarm.IMessage message) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.WSProtocolCodec.OnPacketWrite (Sfs2X.Bitswarm.IMessage message) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Bitswarm.WebSocketClient.Send (Sfs2X.Bitswarm.IMessage message) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.Send (Sfs2X.Requests.IRequest request) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.SendHandshakeRequest (System.Boolean isReconnection) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.OnSocketConnect (Sfs2X.Core.BaseEvent e) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Bitswarm.WebSocketClient.DispatchEvent (Sfs2X.Bitswarm.BitSwarmEvent evt) (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Bitswarm.WebSocketClient.OnSocketConnect () (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.Sockets.WebSocketLayer.CallOnConnect () (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.Core.Sockets.WebSocketLayer.ProcessState () (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
Sfs2X.SmartFox.ProcessEvents () (at <6e4dfbfef0ea44b78882cd0780df98cd>:0)
LoginController.Update () (at Assets/Scripts/LoginController.cs:66)
When I switch my build back to Windows or Android, it runs fine
Re: The type 'SmartFox' exists in both
Make sure that websocket is properly configured in your server. Go to the AdminTool's Server Configurator module, Web server tab and check if it is configured like this:
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: The type 'SmartFox' exists in both
woooo thank you, that did it! "Enable WS/WSS" was not checked
Who is online
Users browsing this forum: No registered users and 89 guests