Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Conflict between Asset's Newtonsoft and PackageManager's Newtonsoft

Discussion in 'Package Manager' started by PotatoVeg, Mar 10, 2020.

  1. tidesnap

    tidesnap

    Joined:
    Nov 14, 2018
    Posts:
    4
    I recently ran into this issue and was able to get around it by going package manager and uninstalling unity version control, then it fixed everything right after that. The version control seems to be adding the newtonsoft json dll everytime you open the project to the cached packages folder.

    It seems they use this for collab so it will probably break that or something later.
    Hope this helps someone.
     
  2. Amigo89

    Amigo89

    Joined:
    Nov 9, 2018
    Posts:
    4
    it broke my project!!!
     
  3. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,063
    Your long term should be supporting sdk style csproj files with native tooling and NuGet support...

    What you are planning it's an ugly workaround...
     
    CodeRonnie likes this.
  4. Thut

    Thut

    Joined:
    Oct 30, 2014
    Posts:
    32
    That's great news, is there any way to get access to a preview of this package? I'm currently running into a issue trying to use some Google APIs which require version 13 of Newtonsoft-Json.
     
  5. UnityManuJack

    UnityManuJack

    Unity Technologies

    Joined:
    May 30, 2019
    Posts:
    11
    Hi!

    com.unity.nuget.newtonsoft-json (3.0.1) with newtonsoft 13.0.1 has now been released!

    Note that this package is meant to be used as a dependency and is not yet discoverable in package manager, you will have to install it manually. (Via package manager "add package by name..." starting 2021, or by editing manifest.json)


    We are aware this is a workaround, the goal here is to unblock newtonsoft Users as soon as possible while looking at native tooling support for future editor iteration.
     
  6. d_sharov

    d_sharov

    Joined:
    Dec 24, 2021
    Posts:
    23
    Hi!
    Installed a new unit analytics in my project. It brought with it a dependency on com.unity.nuget.newtonsoft-json (3.0.2).
    The rest api request framework I'm using doesn't work with com.unity.nuget.newtonsoft-json (3.0.2). It is not possible to deserialize data during the backend il2cpp.
    How can I get around this problem?

    Mono doesn't have this problem.
    Also windows build works fine. The problem is only in the backend il2cpp

    I get errors like this after getting response
    2022.05.19 02:21:53.431 15314 15360 Error Unity #0 0x79e315cbcc (libunity.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #1 0x79e3a1d0d8 (libunity.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #2 0x79e3433460 (libunity.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #3 0x79e343337c (libunity.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #4 0x79ce3f4d60 (libil2cpp.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #5 0x79cd66f688 (libil2cpp.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #6 0x79ce069e00 (libil2cpp.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #7 0x79ce00f698 (libil2cpp.so) ? 0x0
    2022.05.19 02:21:53.431 15314 15360 Error Unity #8 0x79ce6c6698 (libil2cpp.so) ? 0x0
    ----
    2022.05.19 02:21:53.431 15314 15360 Error Unity #21 0x7
     
    Last edited: May 19, 2022
  7. programmercitizen

    programmercitizen

    Joined:
    Jul 14, 2022
    Posts:
    6
    I imported ArtomatixMaterialImporter from the asset store into my project.
    No errors until I hit play:

    Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform. Only one assembly with the same name is allowed per platform. (C:/zunityprojects/004/0terrainscannerquad/Library/PackageCache/com.unity.nuget.newtonsoft-json@3.0.2/Runtime/Newtonsoft.Json.dll)

    Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform. Only one assembly with the same name is allowed per platform. (Assets/ArtomatixMaterialImporter/Plugin/Newtonsoft.Json.dll)

    The asset no longer shows as installed under In Project.

    I looked at the properties of the Newtonsoft.Json.dll within the ArtoMatixMaterialImporter Assets folder.
    Auto Reference and Validate References are both checked.

    I see there are about 183 dependencies on this DLL within my current project.

    I do not want to deal with the headache of a free Unity Asset (even though it was created by Unity).
    How do I safely remove the imported asset? It is no longer showing within the Package Manager.
     
  8. hotroddd1

    hotroddd1

    Joined:
    Feb 12, 2018
    Posts:
    8
    It is now 7/28/22

    I am trying to use JSON .NET for Unity and am getting the Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform error.

    @UnityManuJack I see your comment from March 1, 2022. But to be honest I don't understand your instructions.

    I'm using the Unity version 2021.3.4f1

    What steps do I need to take to allow Unity to its out-of-the-box features and the JSON .NET for Unity Asset? It seems like something in the engine and this 3rd party asset (along with others in this long thread) are using the Newtonsoft.Json.dll simultaneously and it does not like it.

    Please provide step-by-step instructions on how to use the workaround you mentioned with com.unity.nuget.newtonsoft-json (3.0.1) with newtonsoft 13.0.1.

    Thank you.
     
  9. EricJ13

    EricJ13

    Joined:
    Feb 28, 2009
    Posts:
    355
    This worked for me.
     
  10. programmercitizen

    programmercitizen

    Joined:
    Jul 14, 2022
    Posts:
    6
    Unity devs have known about this issue for a while -- I would not recommend throwing out version control over this -- how many assets are complaining this is effecting them?

    Also, when you look at your list of _In Project_ assets do you see any which need to be updated?
     
  11. IsaacPc2

    IsaacPc2

    Joined:
    Sep 17, 2022
    Posts:
    1
    2022 BOYS AND STILL WE HAVE THE SAME PROBLEM OF CONFLICTS BETWEEN TWO F)&"&(/ING PACKAGE CREATED BY UNITY ITSELF. LESSSGOOOOOOOOOOOOOOOOOOOOOOOOOO
     
    RemDust, CodeRonnie, Aylex and 5 others like this.
  12. iMobilityTeam

    iMobilityTeam

    Joined:
    Nov 5, 2018
    Posts:
    5
    i upgrade unity purchasing to 4.4.1 version, "dependencies" contain "com.unity.services.core" package
    and "com.unity.services.core" link to "com.unity.nuget.newtonsoft-json"

    upload_2022-10-10_11-7-6.png
     
  13. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    Hi, this Json-Twin problem occured for me now too and since I am not an experienced coder I have no clue what to do now. I am using unity now since 2 month and during that time it happened to me several times that by installing a package over the package manager something went wrong with my project. In the end it often resulted in giving up the projects progress and restarting it again from scratch. Since my time for that is running out I am looking for a better solution to fix this. How can I delete a installed package from my project?

    The reason why I am facing the problem is that I was trying to read in a JSON file with a jagged array by using JSONutility, which seems not to be capable of doing the job. So I asked for help in the forum which I thankfully received. The advice for me was to not use JSONutility and instead used Newtonsoft JSON.NET with a link to the unity store. But since I already made my experiences with unitys package manager, I knew that installing a new package can very likely result in trouble. So I was skeptical that it might help me. So I went through the package manager if I could find any notification or mentioning that there is already some version of newtonsoft json what ever in use or installed. But since I couldn't find any thing I thought: "Ok, might have been one of my already "deleted" Projects ( or lets better call it "abandoned" Project since I couldn't figure out how to really get rid of old project abominations ) that might have had this included". So I gave it a try, even I was sure it might cause me trouble. And here I am.

    So is there any help that a noob like me gets out of this trouble?
     
    CodeRonnie and HuskyWo1fvr like this.
  14. HuskyWo1fvr

    HuskyWo1fvr

    Joined:
    Aug 29, 2022
    Posts:
    1
    I am in the exact same situation as you. Seems crazy that no one has sorted this for several years. I am trying to install an oculus addon. An essential one that allows you to actually move..... If I cant get this working i cant work out how to make a vr game for oculus.
     
  15. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    Due to lack of knowledge I decided to rewrite my code again. I changed my 3D Array in a way that it is now several Lists in an object, and then I am making a list of this objects. like that I can use the unity internal JSON reader in combination with a stream Reader that reads in any file in a directory folder. which means I am not anymore reading in a single JSON file. More like for each object I am creating I am reading an own JSON file. Its hard to juggle in my mind with that structure, but at least in the end its working now.

    its something like this if I am right with the concept I am using now:

    Array[
    param1[ Arr1[ ], Arr2[ ], Arr3[ ] ],
    param2[ Arr4[ ], Arr5[ ] ]
    ]

    -->

    public class Arrrrr
    {
    // param1 - I accepted that for now I am working here with a fixed "element" count
    List<> Arr1;
    List<> Arr2;
    List<> Arr3;
    // param2 - I accepted that for now I am working here with a fixed "element" count
    List<> Arr4;
    List<> Arr5;
    }

    List<Arrrrr> Array;

    Since I have many more arrays in the 3rd dimension in usage than this example is showing, I wanted to solve it by a 3D array.

    I hope this concept seems to be understandable and maybe helpful for anybody with the same problem. I'm sorry that I cant share any code snippets to this case.
     
  16. danieltanfh95

    danieltanfh95

    Joined:
    Mar 12, 2019
    Posts:
    2
    Very fun. Removing version control (not sure why is it even the default) via package-manage->Unity Registry works
     
  17. carsonherrick

    carsonherrick

    Joined:
    Dec 19, 2016
    Posts:
    6
    There is no Newtonsoft package available in Package Manager right now.
    Everyone points here to say get this package.
    But in the released packages page, and in Unity 2021.3.19, there is no Newtonsoft package.

    For now, should I get the "regular" .NET package, from Newtonsoft. Or what?
    Thanks.

    EDIT
    Sorry, missed this:
     
    Last edited: Feb 21, 2023
    CodeRonnie likes this.
  18. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    535
    I went ahead and wrote up the exact steps I followed to resolve this issue when migrating an old project, based on instructions found here: https://docs.unity3d.com/Manual/upm-embed.html. The key is to embed the package and remove all other versions. The embedded version will take precedence for Unity and your other modules, and can be modified to suit your needs.

    These steps will need to be taken into account and well documented for users when publishing assets which depend on Json.NET to the Asset Store. The specific Json.NET package requirements should be clear to the consumer.

    Steps for embedding the Newtonsoft Json.NET package into your project:
    1. Open the Package Manager window.
    2. Select the '+' menu in the top left corner.
    3. Select "Add package by name...".
    4. Paste "com.unity.nuget.newtonsoft-json" into the "Name" field.
    5. Select the "Add" button.
    6. Expand the "Packages" directory in the Project window.
    7. Right-click the "Newtonsoft Json" folder, then select "Show in Explorer". Opening the package this way reveals the actual package that is currently referenced by Unity. Currently, this should be in the "Library/PackageCache/" directory of your project.
    8. Open another file explorer window to the "Packages" directory of your project.
    9. Copy the "com.unity.nuget.newtonsoft-json@[major].[minor].[build]" package folder from the "Library/PackageCache/" directory to the "Packages/" directory.
    10. Remove the "@[major].[minor].[build]" section of the package folder name that is now in the "Packages/" directory.
    11. Ensure the newly embedded package will be added to source control.
    12. All modules that depend on Json.NET should have their own locally embedded versions of Json.NET assemblies removed. For example, at this stage I deleted the "Assets/JsonDotNet/" directory from my project and my issues went away.
    13. You may now customize the package, as long as all dependent modules are compatible with the customized version. If some modules do not agree on an acceptable version, then I think those modules are not compatible.
     
    Last edited: Jun 9, 2023
  19. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,088
    what is the latest on this??