Creating a reusable library for Unity

Hi all,

Sorry for the n00b question, but I Googled it all day and still can’t find the answer to my problem.

I’m new to Unity and I want to create an reusable library to Unity projects (like an assemly for common .NET projects) in order to share code between different games.

The only way that I can do that is by placing the entire source code into Assets folder, but I think this is not the best way to do this task.

Anyone can help me?

What you could do is reference the UnityEngine DLL from a Mono project and develop your behaviors there, then import the resultant DLL into your projects.

I am currently thinking about a solution for this on my own,

Problems that occur with any kind of external .dll files are, that whenever you rename a Class in the Project of your external library, all of Unitys references to that script are broken and Unity thinks the script is gone. So if you’ll ever need to refactor your code you’re running into huge problems.

Also if you have a lot of Monobehaviors in your .dll File in the Project view of Unity it’s going to get really messy because you can’t create subfolders in a .dll file. So all Monobehaviors are just sorted alphabetically which is also very annoying.

I wouldn’t recommend that.