Home > Blockchain >  System.Data.SqlClient does not exist in a Unity project
System.Data.SqlClient does not exist in a Unity project

Time:12-11

I make a small project in Unity and I'm having a problem when I want to use the System.Data(.SqlClient) package. I tried to make a 'custom' reference, to the dll I downloaded separately for this purpose and got no luck with it. Anybody faced this problem before? I just can't get it to work. I want to use an SQL server with the game I'm doing but can't use commands like SqlConnection. The weird thing is that I succeded in Visual Studio (doesn't appear in the error list) but when I return to Unity it's still shown as a compiler error.

Edit: Just to clarify. I tried to use the default dll. I used NuGet to get another one. I used PowerShell's install command to get the System.Data.dll and also download 2 different from the internet from a trustworthy site. None of these ones are working with my Unity project.

Thank you for your help in advance!

CodePudding user response:

The solution that helped me is to set the Framework Unity uses from .NET Standard 2.1 to .NET Framework.

Exact steps: EDIT -> Project Settings -> Player -> Api Compatibility Level -> Set from .NET Standard 2.1 to .NET Framework || After that it worked for me.

  • Related