Search Unity

[Solved] Include a DLL - Debug / Release version

Discussion in 'Scripting' started by otz20100, Oct 17, 2016.

  1. otz20100

    otz20100

    Joined:
    Oct 17, 2016
    Posts:
    13
    Hi all,

    I compiled a DLL in MonoDev in Debug and Release mode, and imported it in my unity project (according to https://docs.unity3d.com/Manual/UsingDLL.html), no problem so far...

    Debug DLL contains "useless" feature in production, and I want to optimize this one, and use the release version of my DLL.

    There is a way to let Unity choose the version correctly depends on build mode selected in Unity?

    Tried hierachy, but was just a nice try, didn't work as hoped :p
    <project folder>/bin/Debug/DLLTest.dll
    <project folder>/bin/Release/DLLTest.dll
    (Stupid try, I admit...)

    Any clean solution?

    Thanks!
     
  2. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The way I usually see this done is that the Unity project has a folder like "Assets/Dlls", and then in Visual Studio or whatever you're using to switch between Debug and Release, you add a pre-build step to copy all the DLL's from their original locations outside the Unity project into the "Assets/Dlls" folder. When building Debug you'd copy from the original debug folders, and when building Release you'd copy from the original Release folders. So you'd be overwriting them each time, but (I think) Unity won't notice when you're copying the same versions over themselves and will only recompile everything when you switch between debug and release.
     
  3. otz20100

    otz20100

    Joined:
    Oct 17, 2016
    Posts:
    13