- Home /
Visual Studio adding custom references
Hi everyone,
I want to add a custom Classlibary to my Unity project in visual studio that is embedded in an other c# project. But when I right click on references I'm not able to add a new reference like in standard c# project generated in vs. Anyone an idea what i have to do to add a class from an other project.
cheers, Robert
Answer by troien · Apr 06, 2016 at 08:22 AM
See Plugins.
A very short summary:
create a dll.
Put the dll into a folder named 'Plugins' inside the Assets folder (Unity 5.0 and later don't require this, just place in somewhere inside your assets and use the inspector)
enjoy.
But the link explains it a lot better ^^ (after following the link, click next for more info on how to do all of this, as this topic spans several pages in the manual)
It does work, but I agree that this tutorial does not cover everything that has to be in place for it to work.
there are many cases why this might not work, not all of them are covered in that tutorial sadly and that means its really just learning through trial and error.
For instance, the .net framework used to build the dll has to be right, as explained in this question. (For which .Net version, look at this question)
Now like I said, there can be more reasons, the one I just said was the only one I had problems with (or at least the only one I can remember), but I'm sure it's not the only problem you could encounter...
Usually if you got to the point where you want to use a dll in Unity, you have decent knowledge of C# and Unity and should be able to solve most of these problems (as long as you have access to the source code of the dll at least). To start I would suggest creating a small project with just one test class, build it to dll and then try and see if you can follow the linked manual pages to access this dll through code.