• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Silen.S.Sin · Aug 17, 2013 at 08:02 AM · dll

Unity and the dlls.

Hi, first sorry for my English I don't speak very well, I'll try my best for you understand me.

So, I'm trying to use dll for connect Unity to SQL (it's not the problem), I use C#. I start my script like this :

 using UnityEngine;
 using System;
 using System.Data;
 using System.Data.SqlClient;

So Unity send me an error : "'Data' does not exist in the namespace 'System'". Here it is ok, I paste the System.Data.dll in the project folder ".../MyProject/Assets/DLLs/".

Note that I add this version of dll : 4.0.30319.18047 (one of the latest).

So, the error disappear, but now it say : "Could not load type 'System.Threading.Tasks.Task' from assembly 'mscorlib'".

I make test with Visual Studio and MonoDevelop, the result is...

System.Data.dll make a reference to "System.Threading.Tasks.Task" and say to Unity to search in the .NET 2.0 for the file. Unity found the mscorlib.dll in the folder and... the dll is outdated... effectively "Tasks.Task" doesn't exist. I watch the .NET 4.0 mscorlib.dll and in this version "Tasks.Task" exist.

So why my dll say to use an outdated version? Why Unity don't use by itself the latest version? Why I can't choose my version?

I've try to paste the good mscorlib.dll in my "./DLLs/" folder but no effect, I try to include the good dll in the Project Reference no effect or double file error depending on how I arrange the script.

After I think "Hey if you use a anterior version of System.Data.dll probably it's doesn't search for Tasks.Task". And a lot of error appear.

Am I damned?

Someone can help me?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
13
Best Answer

Answer by ArkaneX · Aug 17, 2013 at 10:18 AM

The problem is you're probably adding System.Data.dll from standard .NET Framework, which requires mscorlib provided by Microsoft. You have to use Mono implementation of System.Data.dll, which you can find under:

 C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\unity

Out of the box this will work in Editor, but not after build. At least id didn't worked for me - I got "CodePage 1252 not supported". After a bit of googling, I found this info. Adding I18N.dll and I18N.West.dll to the project, fixed the problem.

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Silen.S.Sin · Aug 17, 2013 at 11:45 AM 0
Share

Thank you, it work instantly. Want to up vote but can't before 15 reputation, thank you :D.

avatar image Bunny83 · Aug 17, 2013 at 11:47 AM 1
Share

@silenssin: Don't post comments as answers! I've converted your answer into a comment. Next time use the "add new comment" button or your "answers" will get downvoted.

Ins$$anonymous$$d of posting a comment / answer you should accept the answer if it solved your problem.

avatar image ArkaneX · Aug 17, 2013 at 12:03 PM 0
Share

Agree with @Bunny83 - users have to accept good answers. This way the whole Unity community can benefit.

avatar image XcentY · Oct 08, 2014 at 10:43 PM 0
Share

I've been working with Visual Studio (.NET VB, .NET C++), I've benn working with Eclipse (Java). But that the first workspace where I've to copy referenced built-in libraries to make them recognized. (Also Old Built-in libraries from .NET 2.0 Framework)...

And also Copying my third party libraries to the editor path to avoid "missing namespace" issue in Unity while I don't have this problem in monodevelop.

Then sync monodevelop with Unity to avoid "invalid reference" for C-Sharp First pass scripts.

Now adding 2 languages libraries to avoid problem in the build.

Unity has to make some adjustment. It's a great tool for 3D scenes, anims, and little games. But once you come with great game, you certainly run in major issue with monodevelop and you think developing your logic in Visual Studio.

avatar image sug4rz · Feb 11, 2016 at 06:44 PM 1
Share

This answer don't fix the problem in Unity 5.3.2 :( Somebody has a solution?

avatar image RafaelDarde sug4rz · Jul 03, 2016 at 07:03 AM 0
Share

Hello! You found the solution ?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

How to change the target framework to Unity 3.5 .net Subset Base Class Libraries in the MonoDevelop-Unity? 1 Answer

Alternative for System.Collections.Generic.List, to reduce build size. 1 Answer

Why does my build keep crashing? 2 Answers

Compiled managed dll that references Unity APIs from different Unity versions 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges