C# to Javascript: Custom Event Delegation?
- by James Simpson
I'm working on a project in Unity3D with Javascript, and I'm trying to implement the SmartFoxServer API (http://smartfoxserver.com) in Javascript instead of their example C# code. I've gotten most of it converted correctly, but I am still getting an error at runtime with the following line involving delegation to a C# file that is in the API (SFSEvent.cs).
C# original:
SFSEvent.onConnection += HandleConnection;
Javascript (or whatever I've turned it into):
SFSEvent.onConnection = Delegate.Combine(HandleConnection);
Error: InvalidCastException: Cannot cast from source type to destination type.