[英]SQL Server with Unity3D
I want to use SQL Server with Unity.我想将 SQL 服务器与 Unity 一起使用。 I add
System.Data.dll
to assets in Unity project but I get this error:我将
System.Data.dll
添加到 Unity 项目中的资产,但出现此错误:
The type or namespace name 'SqlClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
命名空间“System.Data”中不存在类型或命名空间名称“SqlClient”(您是否缺少程序集引用?)
Then I added sqlclient.dll
to the assets folder, but I still get:然后我将
sqlclient.dll
添加到 assets 文件夹中,但我仍然得到:
The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'.
在命名空间“System.Data.SqlClient”中找不到类型名称“SqlConnection”。 This type has been forwarded to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
此类型已转发到程序集“System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”。
Consider adding a reference to that assembly.考虑添加对该程序集的引用。
Please help me?请帮我? What's wrong?
怎么了?
After some researches, looks like there are much easy way to import sql in new versions of Unity:经过一些研究,看起来在新版本的 Unity 中导入 sql 有很多简单的方法:
nuget install System.Data.SqlClient -Version 4.7.0 -OutputDirectory <some temp dir>
nuget install System.Data.SqlClient -Version 4.7.0 -OutputDirectory <some temp dir>
Api Compatibility Level
.Api Compatibility Level
。 It will be .NET 4.x
or .NET Standard 2.0
.NET 4.x
或.NET Standard 2.0
Plugins
directory in folderPlugins
目录<some temp dir>/lib/<api level>/System.Data.SqlClient.dll
to Plugins
directory.<some temp dir>/lib/<api level>/System.Data.SqlClient.dll
到Plugins
目录。 For example, in my case there are .NET Standard 2.0
compat.例如,在我的情况下,有
.NET Standard 2.0
兼容。 level and <some temp dir>/lib/netstandard2.0/System.Data.SqlClient.dll
library.级别和
<some temp dir>/lib/netstandard2.0/System.Data.SqlClient.dll
库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.