sketchfab / unity-plugin

291 stars 39 forks source link

Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included or the current platform. (Unity 2020.3.10f1 LTS) #9

Closed lukeskt closed 2 years ago

lukeskt commented 3 years ago

Hi there,

Sketchfab plugin has broken on 2020.3 LTS, I'm getting the following errors on importing the package:

image

Let me know if you need more info.

Thanks!

FeuerTiger86 commented 3 years ago

Same for me. Renaming the file in the Sketchfab for Unity folder removes the error, but I haven't checked if everything still works.

SabinT commented 3 years ago

This error means that something else in the Unity project already has Newtonsoft.Json as a dependency, so now the project has 2 versions of the same library as 2 DLLs. Hence one of them needs to be removed. Most likely Unity themselves started using Newtonsoft.Json in one of the built-in packages at some point, which means the sketchfab package would import fine without errors in older versions of Unity, and would need to have this dependency in order to support older versions of Unity that don't include Newtonsoft.Json by default.

I think this might be solved by converting the sketchfab unitypackage into a UPM package, where dependencies can be specified via a package.json. IIRC, this file supports semver, so it should be possible for the sketchfab package to specify a version range that is compatible with the existing dependencies of Unity's built in packages.

SabinT commented 3 years ago

Well actually the problem is even worse in 2021. Even if you remove the sketchfab DLL, you still get an error, because sketchfab expects one version of Newtonsoft.Json, but Unity has another.

Error for reference (Unity 2021.1.13f1) - after deleting sketchfab's Newtonsoft.Json.dll and trying to reimport:

Assembly 'Assets/Sketchfab For Unity/Dependencies/Libraries/GLTFSerialization.dll' will not be loaded due to errors:
GLTFSerialization references strong named Newtonsoft.Json Assembly references: 10.0.0.0 Found in project: 12.0.0.0.
Assembly Version Validation can be disabled in Player Settings "Assembly Version Validation"
SabinT commented 3 years ago

Confirmed that in 2021 for this to work, you have to turn off strong name validation (after deleting Newtonsoft.dll), and reimport. image

AurL commented 3 years ago

Hi A new version with a fix for this Newtonsoft.json conflict has just been released: https://github.com/sketchfab/unity-plugin/releases/tag/1.2.1 The plugin should work with versions 2020+ now.

(Note that there are still other conflicts to handle , like the one on Ionic.Zip )

lukeskt commented 2 years ago

Thanks very much, can confirm this issue is resolved for me by the new release.

NeonWizard commented 1 year ago

Hi A new version with a fix for this Newtonsoft.json conflict has just been released: https://github.com/sketchfab/unity-plugin/releases/tag/1.2.1 The plugin should work with versions 2020+ now.

(Note that there are still other conflicts to handle , like the one on Ionic.Zip )

I'm still having this issue with Unity 2019.4.31f and plugin version 1.2.1. Is there plans to fix this for Unity versions <2020?