Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLua导出错误 #295

Open
hanyq opened this issue Jan 7, 2020 · 1 comment
Open

SLua导出错误 #295

hanyq opened this issue Jan 7, 2020 · 1 comment

Comments

@hanyq
Copy link

hanyq commented Jan 7, 2020

Unity2019.2导出集合相关接口时编译报错。 看导出的源码,是SLua多导出了几个方法。
比如Dictionary,多了两个个构造方法,其中一个参数是
IEnumerable<System.Collections.Generic.KeyValuePair<System.Int32,System.String>>;

多导出一个方法:public bool Remove (TKey key, out TValue value);

@hanyq hanyq changed the title SLua有群吗? SLua导出错误 Jan 7, 2020
@GrandZhuo
Copy link

这是因为Unity运行时和编译时加载的dll不同导致的。

问题会出现在当Scripting Runtime Version选择.Net 4.x时(Unity 2019.2.6中这项设置貌似移除了),如下图:

image

运行时

Unity运行时加载的dll是Unity安装路径\Editor\Data\MonoBleedingEdge\lib\mono\unityjit\mscorlib.dll 如下图:

image

编译时

Unity编译时加载的dll是Unity安装路径\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\mscorlib.dll 如下图:

image

解决方法

  1. Scripting Runtime Version选择.Net 3.5(需要评估对项目的影响)
  2. 导出时添加黑名单过滤掉报错的方法。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants