Search Unity

Question How to resolve conflicts (eg, Newtonsoft) in plugin?

Discussion in 'Package Manager' started by MrLucid72, Aug 1, 2022.

  1. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    996
    Since 9 out of 10 packages will use Newtonsoft, how the heck do plugin devs resolve dll dependencies?

    * Eg: Newtonsoft is everywhere in every package.
    * Eg: Unity <2019 doesn't include a bunch of core dlls, but 2020+ does.

    How to gracefully resoolve these as a plugin dev, where the current workaround is to get the end-user to scavenge through and delete 1 of them (which may cause issues for different versions).
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,145
    There is an official Newtonsoft-json package available through the Unity Package Manager. It's intended for Unity's internal usage, so it's not visible through the UPM UI.
    But you can install it by adding the dependency manually to the Packages/manifest.json file:
    Code (CSharp):
    1. "com.unity.nuget.newtonsoft-json": "3.0.2"
    https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@3.0/manual/index.html

    If your Unity plugin is a UPM package, then you can add this dependency to the 'dependencies' section in the 'package.json' file of your package.
     
    MrLucid72 likes this.