Using external Libraries in Unity

Good day,

I wrote my own .dll for Networking Operations that I now would like to use within Unity.
But I’m not quite satisfied by adding a new Reference to each new MonoBehaviour Class I write.
So, what’s the best way to this? Is it even recommended?

I used the Search, but I didn’t find any post exactly describing my problem here.

Edit: Since I’m bad at asking questions, here’s the same question, rephrased:
Did anyone ever use external Libraries in Unity over Visual Studio? If yes, how did you “install” them?

1 Like

What do you mean by “adding a new reference”? A code snipped showing the unsatisfactory bits would help.

1 Like

I’m talking about the ‘Add Reference’ Option in the ‘References’ Dropdown Menu within Visual Studio, under the Solution Explorer.

1 Like

We need more information. Is your library managed or unmanaged?

1 Like

What’s a managed Library? Maybe my missing knowledge about just those things results in giving too little information, sorry.

All I (usually) do is Build my libraries into a shared folder where all my projects get them from. Since I normally just use MonoGame this is what worked best for me during development.

1 Like

Are your libraries written in a managed language(C#) or an unmanaged language(C/C++/Rust)?

1 Like

Thanks for clearing that up.
Those libraries are all written in C#, using only the basic .NET System.* Namespace.

Edit: I could try to rephrase my question:
Did anyone ever use external Libraries in Unity over Visual Studio? If yes, how did you “install” them?

1 Like

In your case you can simply put your managed .dll in \Assets\Plugins and add “using yourLibraryNameSpace;” at the top of your scripts.

8 Likes

Thanks! That’s just the answer I needed. Sorry for taking your time!

3 Likes