c# - Unity (5.5) 插件在导出 Windows 应用程序文件 (EXE) 时使用 SQLite 数据库错误

标签 c# unity-game-engine sqlite

我正在使用 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 游戏/应用程序项目中。

问题已解决。

enter image description here

关于c# - Unity (5.5) 插件在导出 Windows 应用程序文件 (EXE) 时使用 SQLite 数据库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49981863/

相关文章:

c# - 如何在 ASP.Net MVC 应用程序中使用来自 WCF 身份验证服务的身份验证 cookie

android - 在 Android/Unity 上使用 MODE_WORLD_READABLE 共享文件

c# - 所有物体都有rigidbody 2d和boxcollider2d并且没有碰撞

java - 如何使用java sqlite连接数据库功能?

sql - Rails 使用 SQL 提前订购

c# - 您对异常消息使用什么样式?

c# - Linq 查询创建字符串数组错误列表

c# - 如何在页面 View 或按钮单击之间增加 ASP.NET (C#) 中的变量

unity-game-engine - 对 Watson Assistant V2 中的任何查询都获得相同的响应 : Watson-Unity-SDK

sql - GORM many2many 预加载错误