DLL - Best Practice

Hey everyone,

I have a question around building DLLs for unity packages. In the past, I have only built packages that target the system namespaces, this time around I will be targeting the UnityEngine and UnityEditor.

So one question is, do add a new project to the solution generated by Unity. Or do you prefer to create a separate one altogether?

Is there a way to exclude all the unity DLLs from being built when you build your DLL?

This is how I have done this in the passed. I would create a new folder for the library project in the unity project folder. On the same level as assets, project settings, etc. Then have a custom build script that would build the DLL into the assets folder. Just like this one > GitHub - harley-codes/ItchToolkit: A Library for the Itch.io API

As for my previous question, if I was to do it like this when the library target UnityEngine/Editor, then its going to copy all those unity DLLs too.

So how do you guys like to handle this?

look up the reference to the Unity Editor dll in the csproj that you added and go to the properties of it to set Copy to false. It’s probably on true which copies the dll of the reference to the build folder

1 Like

I didn’t even think to check if there was an option to turn off copying additional DLLs. Chers dude XD