我们有时想将编写的C#代码编译成库,方便后面使用。

我们可以使用以下命令编译成库:

Unity编译C#库的注意事项

1:使用这种命令的时候,里面包含的Editor文件夹千万需要另建一个Editor的库

2:代码中包含 #if Unity_Editor 宏定义的命令的也不要编译进去,需要单独剥离出来

如果不遵守以上两点,编译的库在另外一个工程里面使用打包的时候,会报这样的错误

ArgumentException: The Assembly UnityEditor is referenced by Tool ('Assets/Tools/JSBase/DLL/Tool.dll'). But the dll is not allowed to be included or could not be found.

最后希望看到这个贴子的朋友,对编译成库使用的时候出现bug有所帮助。

相关文章:

  • 2021-02-22
  • 2021-06-14
  • 2021-11-07
  • 2021-11-26
  • 2020-02-29
  • 2021-11-29
  • 2019-01-21
  • 2020-11-18
猜你喜欢
  • 2021-09-20
  • 2021-08-29
  • 2019-09-26
  • 2021-11-11
  • 2021-10-28
  • 2019-10-11
  • 2021-09-29
相关资源
相似解决方案