Hello,
we have just released version 1.6.0beta of the Unity/C# API that support the new WebGL exporter in the upcoming Unity 5 (currently in beta).
If you're planning to use the WebGL exporter or you're already working with the Unity 5 beta you can download the API and test them in your Unity 5 project:
http://www.smartfoxserver.com/download/sfs2x#p=client
We will also highly appreciate your feedback, so if you find any problems please let us know in this section of the forum.
NOTE #1:
Make sure to read and follow the instructions in the README.txt file contained in the beta API package.
NOTE #2:
For all developers working in Unity 4.x there's no need advantage in using this beta release, as it solely addresses the Unity 5 WebGL exporter.
Enjoy!
C# API for Unity 5 beta, available!
Re: C# API for Unity 5 beta, available!
Hi
I believe this is a bug on this smartfox.dll for unity. I've been using the older dll for ages without any problem and today I decided to upgrade the server and clients to the latest version.
The issue is that it seems that udp is never inited.
I have the usual
connect
login -> server extension custom login that returns a
ISFSObject outData = (ISFSObject) event.getParameter(SFSEventParam.LOGIN_OUT_DATA);
outData.putUtfString(SFSConstants.NEW_LOGIN_NAME, nick);
then on the client onLogin I have the
smartFox.InitUDP(ConnectionIP, Port);
all of this is called as usual, now the problem is that my OnUdpInit method is never called. It's setup with the usual
smartFox.AddEventListener(SFSEvent.UDP_INIT, OnUdpInit);
The funny thing is that on the server log there is nothing, I see no udp trying to connect or anything like that. I have both tcp/udp listening to 443 to make sure it's not blocked.
Am I missing something? As I said, this was just fine before the update.
I believe this is a bug on this smartfox.dll for unity. I've been using the older dll for ages without any problem and today I decided to upgrade the server and clients to the latest version.
The issue is that it seems that udp is never inited.
I have the usual
connect
login -> server extension custom login that returns a
ISFSObject outData = (ISFSObject) event.getParameter(SFSEventParam.LOGIN_OUT_DATA);
outData.putUtfString(SFSConstants.NEW_LOGIN_NAME, nick);
then on the client onLogin I have the
smartFox.InitUDP(ConnectionIP, Port);
all of this is called as usual, now the problem is that my OnUdpInit method is never called. It's setup with the usual
smartFox.AddEventListener(SFSEvent.UDP_INIT, OnUdpInit);
The funny thing is that on the server log there is nothing, I see no udp trying to connect or anything like that. I have both tcp/udp listening to 443 to make sure it's not blocked.
Am I missing something? As I said, this was just fine before the update.
Re: C# API for Unity 5 beta, available!
Ok, I decompiled the dll and found this at the beginning of InitUDP
public void InitUDP(string udpHost, int udpPort)
{
if (this.socketClient.UdpManager == null)
{
this.Logger.Warn(new string[]
{
"UDP protocol not supported."
});
return;
}
I get that error printed out all the time: UDP protocol not supported.
Then I searched for that UdpManager and it's actually set at the end of that block... in short, UdpManager is ALWAYS null.
Can you please send a fix? i'm stuck because of this on my unity development
public void InitUDP(string udpHost, int udpPort)
{
if (this.socketClient.UdpManager == null)
{
this.Logger.Warn(new string[]
{
"UDP protocol not supported."
});
return;
}
I get that error printed out all the time: UDP protocol not supported.
Then I searched for that UdpManager and it's actually set at the end of that block... in short, UdpManager is ALWAYS null.
Can you please send a fix? i'm stuck because of this on my unity development
Re: C# API for Unity 5 beta, available!
I confirm that there was an issue in the API related to UDP initialization.
Now it has been fixed, so please download again the beta package of the API from this page: http://www.smartfoxserver.com/download/sfs2x#p=client
Now it has been fixed, so please download again the beta package of the API from this page: http://www.smartfoxserver.com/download/sfs2x#p=client
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: C# API for Unity 5 beta, available!
I may have found another bug in the WebGL version of smartfox.dll. It appears to occur when calling Sfs2X.Entities.Data.SFSObjectLite.GetByteArray (System.String key). Here's the stack trace:
InvalidCastException: Unable to cast object of type 'SFSArrayLite' to type 'ISFSObject'.
Sfs2X.Entities.Data.SFSObject.GetValue[Object] (System.String key)
Sfs2X.Entities.Data.SFSObject.GetSFSObject (System.String key)
Sfs2X.Entities.Data.SFSObjectLite.GetByteArray (System.String key)
NetworkBlockUpdate..ctor (ISFSObject data)
NetworkBehavior.HandleJoinRoom (ISFSObject data)
NetworkBehavior.OnExtensionResponse (Sfs2X.Core.BaseEvent evt)
Sfs2X.Core.EventListenerDelegate.Invoke (Sfs2X.Core.BaseEvent evt)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt)
Sfs2X.SmartFox.ProcessEvents ()
NetworkBehavior.FixedUpdate ()
InvalidCastException: Unable to cast object of type 'SFSArrayLite' to type 'ISFSObject'.
Sfs2X.Entities.Data.SFSObject.GetValue[Object] (System.String key)
Sfs2X.Entities.Data.SFSObject.GetSFSObject (System.String key)
Sfs2X.Entities.Data.SFSObjectLite.GetByteArray (System.String key)
NetworkBlockUpdate..ctor (ISFSObject data)
NetworkBehavior.HandleJoinRoom (ISFSObject data)
NetworkBehavior.OnExtensionResponse (Sfs2X.Core.BaseEvent evt)
Sfs2X.Core.EventListenerDelegate.Invoke (Sfs2X.Core.BaseEvent evt)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt)
Sfs2X.SmartFox.ProcessEvents ()
NetworkBehavior.FixedUpdate ()
Re: C# API for Unity 5 beta, available!
Byte arrays are not supported when using WebGL. We will (possibly) remove the methods to get/put byte arrays in the final API.
As a workaround you should convert the byte array to an array of integers, and convert it back on the other side.
As a workaround you should convert the byte array to an array of integers, and convert it back on the other side.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: C# API for Unity 5 beta, available!
A new version of the C# API (beta 3) is available on the API download page: http://www.smartfoxserver.com/download/sfs2x#p=client
We finalized the WebGL support in Unity.
We finalized the WebGL support in Unity.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: C# API for Unity 5 beta, available!
The final C# API v1.6.0 is now available.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team