Search code examples
c#unity-game-enginesmartfoxserver

VerificationException when using Unity in Web Player mode


I'm working on a web project that uses Unity3D and SmartFox and I'm having trouble with a specific setting. Whenever my editor is set to "Web Player", I get the following exception:

VerificationException: Error verifying Sfs2X.Logging.LoggerEvent:LogEventType (Sfs2X.Logging.LogLevel): Object not compatible with constrained type at 0x000e

Which is thrown on the 2nd line:

SmartFox server = new SmartFox (true);
server.AddLogListener(logLevel, (EventListenerDelegate)OnDebugMessage);

(And if I omit that line, it is thrown anytime I call a method from the server variable)

It works if I build in Standalone mode. It also works on another colleague's computer (Web mode), but I can't find any difference in our project settings.

Reading about the exception didn't help much, except that it is thrown whenever you write unverifiable code and try to compile it to a safe(?) binary. I couldn't find anything else about the other parts of the error.


Solution

  • For anyone else looking, Luke got an answer from Smartfox forums:

    http://www.smartfoxserver.com/forums/viewtopic.php?f=20&t=17686

    Going back to Mono Develop 4.0.1 (delivered with Unity) fixes the issue. If you are still struggling with this issue contact us by email so we can provide a fixed dll.