Trying to have multiple (platform-dependent) versions of the equivalent DLL but receiving error on build.
This seems to be thing with the “Define Constraints” field on Import Settings. But here’s the test setup:
- Assets/
- SampleScriptUsingSampleDll.cs
- Plugins/
- Sample (DEBUG)/
- Sample.dll
(Define Constraints:) "DEBUG"
- Sample (RELEASE)/
- Sample.dll
(Define Constraints:) "!DEBUG"
Work fine in the editor! Only the DEBUG variant is active.
However, trying to build I receive the following errors:
Plugin 'SimpleDllProject.dll' is used from several locations:
Assets/Plugins/SimpleDllProject (not DEBUG)/SimpleDllProject.dll would be copied to <PluginPath>/SimpleDllProject.dll
Assets/Plugins/SimpleDllProject (DEBUG)/SimpleDllProject.dll would be copied to <PluginPath>/SimpleDllProject.dll
Please fix plugin settings and try again.
UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
Plugins colliding with each other.
Build completed with a result of 'Failed'
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:194
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:97
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
It’s like the constraint is ignore in an early stage of the build.
Is this a known problem and/or does anyone have any ideas of a workaround?
Thank you for all yours times.
Hi, I am experiencing the same issue. Did you find any solution?
P.S. I am using Unity 2019.1.0f2
Apparently it’s a known issue and is currently in active status.
https://issuetracker.unity3d.com/issues/identical-dll-files-targeting-different-builds-with-define-constraints-conflict-with-each-other-when-building-a-project
One theoretically possible workaround is to rename the assemblies if you got the source, but have them use the same namespaces. Maybe then you can bypass the plug-in collision check.