我正在使用 Unity 5.5.6f1 开发 Unity 插件
插件包装 SQLite 调用并提供在 Unity 中调用的函数,如下所示
// Unity Plugin
public void doSomething()
{
// Query DB.
}
在Unity游戏项目中使用。
// Unity
unityPluginInstance.doSomething();
我将插件构建到DLL中,并将其放入Unity游戏项目中,当我在Unity编辑器上单击“播放”时,它运行良好。
但是,当我尝试将 Unity 游戏项目导出为 EXE 文件时,它会抛出很多错误。
ArgumentException: The Assembly System.Data.Entity is referenced by System.Data.SQLite.Linq ('Assets/Plugins/MyPlugin/System.Data.SQLite.Linq.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:147)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:184)
UnityEditor.HostView:OnGUI()
我在 Google 上进行了大量搜索,但找不到任何可行的解决方案。
谁能教我如何解决这个错误?非常感谢。
最佳答案
最后,在将我的问题发布到 Stackoverflow 后,我找到了解决方案。
只需在引用中选择 System.Data.Entity 并将其属性“Copy Local”编辑为 True。
构建插件后,System.Data.Entity.dll 将出现在输出文件夹中。我们会将此文件与 MyPlugin.DLL 和其他文件一起添加到 Unity 游戏/应用程序项目中。
问题已解决。
关于c# - Unity (5.5) 插件在导出 Windows 应用程序文件 (EXE) 时使用 SQLite 数据库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49981863/