C# to Javascript: Custom Event Delegation?

Posted by James Simpson on Stack Overflow See other posts from Stack Overflow or by James Simpson
Published on 2010-04-06T01:22:39Z Indexed on 2010/04/06 1:33 UTC
Read the original article Hit count: 421

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about delegate