在 Web Player 模式下使用 Unity 时出现 VerificationException

VerificationException when using Unity in Web Player mode

我正在开发一个使用 Unity3D 和 SmartFox 的 Web 项目,但我在使用特定设置时遇到了问题。每当我的编辑器设置为 "Web Player" 时,我都会收到以下异常:

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

第 2 行抛出:

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

(如果我省略该行,每当我从服务器变量调用方法时都会抛出它)

如果我在独立模式下构建,它会起作用。它也适用于另一个同事的计算机(Web 模式),但我在我们的项目设置中找不到任何差异。

除了当您编写无法验证的代码并尝试将其编译为安全(?)二进制文件时抛出异常外,阅读异常并没有太大帮助。我找不到关于错误其他部分的任何其他信息。

对于其他人,卢克从 Smartfox 论坛得到了答案:

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.