Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
3
Question by yoyo · Jan 13, 2011 at 07:20 PM · assemblycompilingexternal-libraries

How should I add references to additional Mono assemblies?

Unity is built on Mono. Mono includes a large and growing subset of .NET. Much of this subset is available out of the box with Unity, so I can do things like add "using System.Collections.Generic;" to my C# script and start using dictionaries and such.

However, if I add "using System.Data;" (for example) to my script, I get ...

error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System'. Are you missing an assembly reference?

The same thing happens with many other common assemblies. Obviously Unity is giving me a useful set of assemblies, but not everything.

Looking in my Unity 3.1 installation folder, I can see all these DLL's sitting in Data\Mono\lib\mono\2.0, including System.Data.Dll.

I can get my compile error to go away by copying the DLL I want into my Assets\Plugins folder. Is this the correct and best way to add an additional reference? I would prefer something like Visual Studio's reference management -- does this exist with Unity? What if I'm going to build for different platforms, do I need different versions of the DLL's?

This seems like it would be a common question, but searching the docs, answers and forums hasn't turned up a definitive answer. Links appreciated if I overlooked something.

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
4
Best Answer

Answer by Mike 3 · Jan 13, 2011 at 10:03 PM

Try swapping to .NET 2.0 instead of .NET 2.0 Subset in the Player Settings panel for the Api Framework.

If that doesn't give you the ones you want, put the files anywhere except the plugins folder - it's not for managed dlls (Though they should work there, it'll duplicate them in builds, which isn't good for build size).

And if that doesn't work, the dll may just not be compatible

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 yoyo · Jan 13, 2011 at 10:36 PM 0
Share

Good info, thanks $$anonymous$$ike. However ... changing to ".NET 2.0" didn't make any difference. As mentioned, the compile error goes away if I copy the DLL into my Assets folder. I won't use Plugins, thanks -- perhaps Plugins.NET would be a good convention. Is that really the best way to do this? Would be nice if Unity had an assembly selector for adding references. (Guess I can always write my own ... ;)

avatar image rahulpatil6220375 yoyo · Dec 28, 2018 at 12:28 PM 0
Share

error using System.Speech.Recognition;

avatar image rahulpatil6220375 yoyo · Dec 28, 2018 at 12:29 PM 0
Share

please help i try .Net 2.0 subset

avatar image Mike 3 · Jan 13, 2011 at 11:11 PM 0
Share

Oh, sorry, I read the original message as it not compiling when you added them in there. At any rate, that's how you have to add in System.Data and the like, yes. Plugins.NET sounds fine (It's actually exactly what I use myself), just make sure you add your plugin selector to the wiki if you make one! ;)

avatar image Jeff Kingsley · Jan 27, 2011 at 10:13 PM 0
Share

This sounds much like a problem I have...except I am using System.Configuration and a Configuration object. Funny thing is that I have used "Assets->Sync $$anonymous$$onoDevelop Project" to create a solution file. Both $$anonymous$$onoDevelop and Visual Studion 2008 compilers have no problem finding the assembly and building. This seems like a bug/shortfall to me. At the very least, the Editor should allow use of the $$anonymous$$onoDevelop Referance feature (i.e. add the reference in the Editor similar to $$anonymous$$onoDevelop).

avatar image Almund · Feb 26, 2012 at 12:07 AM 0
Share

I had the same issue and it was resolved as mentioned by adding the assemblies in the Assets-folder.

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.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Moving file failed 2 Answers

Script won't update after first successful weaving with Mono.Cecil 1 Answer

Editor scripts into external assemblies? how? 1 Answer

Can I use .NET 4.5 assembly as external library? 1 Answer

C# dll "MissingMethodException" - Before first recompile 1 Answer


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